Hi All,

I'm currently trying to write an S4 class that mimics a data.frame, but stores 
data on disc in HDF5 format.  The idea is that the dataset is likely to be too 
large to fit into a standard desktop machine, and by using subscripts, the user 
may load bits of the dataset at a time.  eg:

> myLargeData <- LargeData("/path/to/file")
> mySubSet <- myLargeData[1:10, seq(1,15,by=3)]

I've therefore defined by LargeData class thus

> LargeData <- setClass("LargeData", representation(filename="character"))
> setMethod("initialize","LargeData", function(.Object,filename) 
> .Object@filename <- filename)

I've then defined the "[" method to call a C++ function (Rcpp), opening the 
HDF5 file, and returning the required rows/cols as a data.frame.

However, what if the user wants to load the entire dataset into memory?  Which 
method do I overload to achieve the following?

> fullData <- myLargeData
> class(fullData)
[1] "data.frame"

or apply transformations:

> myEigen <- eigen(myLargeData)

In C++ I would normally overload the "double" or "float" operator to achieve 
this -- can I do the same thing in R?

Thanks,

Chris

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to