[R] dbWriteTable() command (package RPostgreSQL) does not accept append=TRUE statement
Cornelius Senf
cornelius.senf at geo.hu-berlin.de
Sat Feb 25 13:25:47 CET 2012
Hey everyone!
I try to convert severall raster files into a dataframe and then store
them in a postegresql database using the RPostgreSQL package (see code
example below). The for loop below should ideally attach each rasters
dataframe to the existing table "modis" created with the first raster
(therefore append=TRUE). However, if the program has finished, only the
first raster has been stored. Any ideas why this does not work?
Code:
for (i in tar){
raster<-raster(i)
data<-as.data.frame(raster)
dbWriteTable(con,"modis",data,append=TRUE)
}
Where: "tar" is a list of raster files, "con" a database connection file
and "modis" the database table to be created.
Thanks!
Cornelius
--
__________________________
Cornelius Senf, Bsc.
Humboldt-University of Berlin
Geography Department
Geomatics Lab
www.hu-geomatics.de
More information about the R-help
mailing list