I am trying to solve the following problem using the mmap package:
 
1.) Store some data as a memory mapped file that resides on the disk. 
2.) Open the data and add some new data (or change it) to that file.


1.) works fine using the following code:

cFile <-tempfile()
dfrData <- data.frame(matrix(data=1, ncol=2, nrow=10))
mmapData <- as.mmap(dfrData, file=cFile)
stcData <- mmapData$storage.mode
munmap(mmapData)


2.) Now I want to link mmapAfter to the file that should still reside as cFile, 
or? What is the problem here? The error I get is at the second line of the 
code: "
Error in if (!x$bytes) stop("no data to extract") :   missing value where 
TRUE/FALSE needed". 

mmapAfter <- mmap(cFile, mode=stcData, extractFUN=as.data.frame)
mmapAfter[];
mmapAfter [1,2] <- 2;
mmapAfter [];
munmap(mmapAfter)


I also noted when I execute the following code that 
the  mmapData$filedesc doesn't show the filename I specified in cFile. Is this 
not how it is supposed to be used?


cFile <- 'C:/temp/testmapfile'
dfrData <- data.frame(matrix(data=1, ncol=2, nrow=10))
mmapData <- as.mmap(dfrData, file=cFile)
mmapData$filedesc

Thanks for your help.

Regards,

 
Wolfgang Wu

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to