Open Kevin-Jin opened 7 years ago
Change length.mmap(x)
to return length(x$storage.mode)
if is.data.frame(x)
.
Throw attempt to select more than one element
if length(i) > 1 || length(j) > 1
in `[[`(x,i,j)
.
Throw attempt to select less than one element
if length(i)< 1 || length(j) < 1
in `[[`(x,i,j)
.
Support drop
parameter for `[`(x,i,j)
and exact
parameter for `[[`(x,i,j)
.
Make sure `[[`
drops names for matrices and data.frame
s while `[`
keeps them.
Add support for rbind()
as long as the types match with the storage.mode
.
Support logical values for i
and j
. Also support nrow
×2 numerical and character matrices for i
when x
is two dimensional or is a data.frame
. See ?Extract
.
Fix problems with passing empty vectors for i
or j
to `[[`(x, i, j)
.
Append data.frame to the vector of classes of the mmap object in as.mmap.data.frame(). This way,
is.data.frame()
returns true but S3 generic methods will execute themmap
override instead of thedata.frame
override.Override
`$`(x, i)
operator to returnNextMethod(i)
ifi %in% names(x) || !is.data.frame(x)
, and return`[[`(x, i)
otherwise.Override the 1D selection operator
`[[`(x, i)
to returnNextMethod(i)
ifis.character(i) && i %in% names(x)
, and throwsubscript out of bounds
ifis.data.frame(x) && (is.character(i) && !all(i %in% colnames(x)) || is.numeric(i) && i > x$dim[2]) || !is.data.frame(x) && is.numeric(i) && i > length(x) || i == 0
, and return just columni
otherwise (or celli
if!is.data.frame(x)
).Override the 2D selection operator
`[[`(x, i, j)
appropriately.Change the 1D subset operator
`[`(x, i, [...])
to throwundefined columns selected
ifis.data.frame(x) && (is.character(i) && !all(i %in% colnames(x)) || is.numeric(i) && i > x$dim[2])
, and returnNA
if!is.data.frame(x) && is.numeric(i) && i > length(x)
, and return just columnsi
otherwise (or cellsi
if!is.data.frame(x)
). Return an emptydata.frame
or vector to handle the value of0
fori
.Change the 2D subset operator
`[`(x, i, j, [...])
to throwundefined columns selected
ifis.character(i) && !all(i %in% colnames(x)) || is.numeric(i) && i > x$dim[2]
, and return.Call("mmap_extract", i, j, [...])
otherwise (as it currently does). Return an emptydata.frame
or vector to handle the value of0
fori
orj
.Override
as.data.frame.mmap(x)
to returnNextMethod()
if!is.data.frame(x)
, and returnx
unaltered otherwise.Override
as.list.mmap(x)
to returnNextMethod()
if!is.data.frame(x)
, and returnas.list(x[])
otherwise.Override
as.matrix.mmap(x)
to returnNextMethod()
if!is.data.frame(x) && (is.null(x$dim) || length(x$dim) != 2)
, and returnas.matrix(x[])
otherwise.