[R] ff object in lapply function

khai ktluong71 at gmail.com
Thu Dec 22 07:56:13 CET 2011


Hello. I'm using as.ffdf(mydataframe) to create ffdf objects inside an lapply
loop and returning that. I then use crbind to combine the lapply results
into allData. 

So...simplified flow looks like this. 

res <- lapply(1:nchunks, function(n)
          {
                blah blah with nth chunk
                mydataframe <- data.frame(blah blah)
               dat <- as.ffdf(mydataframe)
               return(dat)
          })

allDat <- do.call('crbind',res)
              
> allDat
     virtual physical row.names
[1,] List,7  List,4   NULL
[2,] List,7  List,4   NULL
[3,] List,7  List,4   NULL
[4,] List,7  List,4   NULL
[5,] List,7  List,4   NULL
[6,] List,7  List,4   NULL
[7,] List,7  List,4   NULL
[8,] List,7  List,4   NULL

> is.ffdf(allDat)
[1] FALSE

>is.ffdf(allDat[1,])
[1] FALSE

I can access the physical data.  After accessing allDat with calls like
below within another function

ffDat <- allDat[1,]
nEvents <- length(ffDat$physical$position)
pos <- ffDat$physical$position[1:nEvents]

several times to retrieve information, I encounter segmentation faults which
forces me to abort out of R. I'm wondering what I should be doing to prevent
the segmentation faults.

Thanks for any advice!



--
View this message in context: http://r.789695.n4.nabble.com/ff-object-in-lapply-function-tp4224441p4224441.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list