[R-SIG-Mac] using RMySQL on OS X 10.6.6 - R 2.12.2

Verbesselt, Jan jan.verbesselt at wur.nl
Thu Mar 24 13:52:30 CET 2011


Hi,


I trying to export data from large images (satellite data) in to MySQL data via R using RMySQL (RMySQL_0.7-5.tgz installed via R Console). The code works fine but after some time it gives to following error:

"
*** caught bus error ***
address 0x100000012, cause 'non-existent physical address'

Traceback:
1: match.fun(FUN)
2: lapply(z, is.object)
3: unlist(lapply(z, is.object))
4: order(jseq)
5: `[<-.data.frame`(`*tmp*`, , value = list(gid = 78014, yr = 2009,     dy = 49, ndvi = 6448, rel = 0))
6: `[<-`(`*tmp*`, , value = list(gid = 78014, yr = 2009, dy = 49,     ndvi = 6448, rel = 0))
7: write.table(value[from:to, , drop = FALSE], file = conb, append = TRUE,     quote = FALSE, sep = "\t", na = .MySQL.NA.string, row.names = FALSE,     col.names = FALSE, eol = "\n", ...)
8: safe.write(value, file = fn)
9: mysqlWriteTable(conn, name, value, ...)
10: is(object, Cl)
11: is(object, Cl)
12: .valueClassTest(standardGeneric("dbWriteTable"), "logical", "dbWriteTable")
13: dbWriteTable(con, "datamod13q1", datamod13q1, append = T, row.names = 0)
aborting ...
Bus error
cube008:MODIS janv$ 
"

As an example I am adding the R script that I am using: 
Which runs through each pixel and exports the data to add table:

 # read all pixels within a certain boundary
 gid <- 1
 col <- 7:428
 row <- 2557:2760

"
# Create first xy table from one image
 for (i in row) {
   for (j in col) {  
     rc <- c(i,j)-1 # line, sample !
     # read data for specific row and column
     ndvi <- getRasterTable(rndvi, offset=rc, region.dim=c(1, 1))
     rel <- getRasterTable(rrel, offset=rc, region.dim=c(1, 1))

     # prepare to insert into MySQL database
     (datamod13q1 <- data.frame(gid=gid,yr=yr, dy=dy, ndvi=ndvi$band1/10000,rel=rel$band1))
     # THIS IS ONE ROW WITH 4 COLUMNS OF NUMERIC DATA
     dbWriteTable(con, "datamod13q1", datamod13q1, append = T, row.names = 0)
     gid <- gid + 1
   }
 }
"

Any advice to solve this error and make this script more efficient are welcome.

Thanks for your help
J



More information about the R-SIG-Mac mailing list