Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Extract.ffdf

Reading and writing data.frames (ffdf)


Description

These are the main methods for reading and writing data from ffdf objects.

Usage

## S3 method for class 'ffdf'
x[i, j, drop = ncols == 1]
## S3 replacement method for class 'ffdf'
x[i, j] <- value
## S3 method for class 'ffdf'
x[[i, j, exact = TRUE]]
## S3 replacement method for class 'ffdf'
x[[i, j]] <- value
## S3 method for class 'ffdf'
x$i
## S3 replacement method for class 'ffdf'
x$i <- value

Arguments

x

an ff object

i

a row subscript or a matrix subscript or a list subscript

j

a column subscript

drop

logical. If TRUE the result is coerced to the lowest possible dimension. The default is to drop if only one column is left, but not to drop if only one row is left.

value

A suitable replacement value: it will be repeated a whole number of times if necessary and it may be coerced: see the Coercion section. If NULL, deletes the column if a single column is selected with [[<- or $<-.

exact

logical: see [, and applies to column names.

Details

The subscript methods [, [[ and $, behave symmetrical to the assignment functions [<-, [[<- and $<-. What the former return is the assignment value to the latter. A notable exception is assigning NULL in [[<- and $<- which removes the virtual column from the ffdf (and the physical component if it is no longer needed by any virtual column). Creating new columns via [[<- and $<- requires giving a name to the new column (character subscripting). [<- does not allow to create new columns, only to replace existing ones.

Subscript expressions and return values

allowed expression -- example -- returnvalue
row selection x[i, ] data.frame or single row as list if drop=TRUE, like from data.frame
column selection x[ ,i] data.frame or single column as vector unless drop=TRUE, like from data.frame
matrix selection x[cbind(i,j)] vector of the integer-matrix indexed cells (if the column types are compatible)
virtual selection x[i] ffdf with the selected columns only
physical selection x[[i]] the selected ff
physical selection x$i the selected ff

Author(s)

Jens Oehlschlägel

See Also

Examples

d <- data.frame(a=letters, b=rev(letters), c=1:26, stringsAsFactors = TRUE)
   x <- as.ffdf(d)

   d[1,]
   x[1,]

   d[1:2,]
   x[1:2,]

   d[,1]
   x[,1]

   d[,1:2]
   x[,1:2]

   d[cbind(1:2,2:1)]
   x[cbind(1:2,2:1)]

   d[1]
   x[1]

   d[[1]]
   x[[1]]

   d$a
   x$a

   d$a[1:2]
   x$a[1:2]

   rm(x); gc()

ff

Memory-Efficient Storage of Large Data on Disk and Fast Access Functions

v4.0.4
GPL-2 | GPL-3 | file LICENSE
Authors
Daniel Adler [aut], Christian Gläser [aut], Oleg Nenadic [aut], Jens Oehlschlägel [aut, cre], Martijn Schuemie [aut], Walter Zucchini [aut]
Initial release
2020-10-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.