Functions for getting physical and virtual attributes of ffdf objects.
# S3 method for ffdf
physical(x)
# S3 method for ffdf
virtual(x)
an ffdf
object
'physical.ffdf' returns a list
with atomic ff objects.
'virtual.ffdf' returns a data.frame
with the following columns
the vmode
of this row (=ffdf column)
logical defining the AsIs
status of this row (=ffdf column)
logical defining whether this row (=ffdf column) represents a matrix
logical reporting whether the corresponding physical element is a matrix
integer identifying the corresponding physical element
integer identifying the first column of the corresponding physical element (1 if it is not a matrix)
integer identifying the last column of the corresponding physical element (1 if it is not a matrix)
ffdf
objects enjoy a complete decoupling of virtual behaviour from physical storage.
The physical component is simply a (potentially named) list where each element represents an atomic ff vector or matrix.
The virtual component is itself a dataframe, each row of which defines a column of the ffdf through a mapping to the physical component.
# NOT RUN {
x <- 1:2
y <- matrix(1:4, 2, 2)
z <- matrix(1:4, 2, 2)
message("Here the y matrix is first converted to single columns by data.frame,
then those columns become ff")
d <- as.ffdf(data.frame(x=x, y=y, z=I(z)))
physical(d)
virtual(d)
message("Here the y matrix is first converted to ff, and then stored still as matrix
in the ffdf object (although virtually treated as columns of ffdf)")
d <- ffdf(x=as.ff(x), y=as.ff(y), z=I(as.ff(z)))
physical(d)
virtual(d)
message("Apply the usual methods extracting physical attributes")
lapply(physical(d), filename)
lapply(physical(d), vmode)
message("And don't confuse with virtual vmode")
vmode(d)
rm(d); gc()
# }
Run the code above in your browser using DataLab