with.ffdf: Evaluate an expression in a ffdf data environment

Description Usage Arguments Value Note See Also Examples

View source: R/with.R

Description

Evaluate an R expression in an environment constructed from a ffdf data frame. (see with). Please note that you should write your expression as if it is a normal data.frame. The resulting return value however will be a ff object.

Usage

1
2
## S3 method for class 'ffdf'
with(data, expr, ...)

Arguments

data

ffdf data object used as an environment for evaluation.

expr

expression to evaluate.

...

arguments to be passed to chunk.

Value

if expression is a vector a newly created ff vector will be returned otherwise if the expression is a data.frame a newly created ffdf object will be returned.

Note

'with.ffdf' assumes that the returned object is of equal length as 'nrow(data)' and must be converted to a 'ff' object In case this is not true, the result won't be correct.

See Also

ffdfwith

Examples

1
2
3
4
5
dat <- data.frame(x=1:10, y=10:1)

ffdat <- as.ffdf(dat)

with(ffdat, {x+y})

Example output

Loading required package: ff
Loading required package: bit
Attaching package bit
package:bit (c) 2008-2012 Jens Oehlschlaegel (GPL-2)
creators: bit bitwhich
coercion: as.logical as.integer as.bit as.bitwhich which
operator: ! & | xor != ==
querying: print length any all min max range sum summary
bit access: length<- [ [<- [[ [[<-
for more help type ?bit

Attaching package: 'bit'

The following object is masked from 'package:base':

    xor

Attaching package ff
- getOption("fftempdir")=="/work/tmp/tmp/RtmpBZzOUk"

- getOption("ffextension")=="ff"

- getOption("ffdrop")==TRUE

- getOption("fffinonexit")==TRUE

- getOption("ffpagesize")==65536

- getOption("ffcaching")=="mmnoflush"  -- consider "ffeachflush" if your system stalls on large writes

- getOption("ffbatchbytes")==16777216 -- consider a different value for tuning your system

- getOption("ffmaxbytes")==536870912 -- consider a different value for tuning your system


Attaching package: 'ff'

The following objects are masked from 'package:bit':

    clone, clone.default, clone.list

The following objects are masked from 'package:utils':

    write.csv, write.csv2

The following objects are masked from 'package:base':

    is.factor, is.ordered


Attaching package: 'ffbase'

The following objects are masked from 'package:ff':

    [.ff, [.ffdf, [<-.ff, [<-.ffdf

The following objects are masked from 'package:base':

    %in%, table

ff (open) integer length=10 (10)
 [1]  [2]  [3]  [4]  [5]  [6]  [7]  [8]  [9] [10] 
  11   11   11   11   11   11   11   11   11   11 

ffbase documentation built on Feb. 27, 2021, 5:06 p.m.