Learn R Programming

ffbase (version 0.13.3)

ffwhich: Create an index from a filter statement

Description

ffwhich creates an ff integer index vector from a filter expression. The resulting vector can be used to index or subset a ffdf or ff vector.

Usage

ffwhich(x, expr, ...)

Arguments

x

ff or ffdf object

expr

R code that evaluates to a logical

...

not used

See Also

ffindexget ffindexset

Examples

Run this code
# NOT RUN {
# create a ff vector
x <- ff(10:1)
# make an ff index vector
idx <- ffwhich(x, x < 5)
# use it to retrieve values from x
x[idx][]

# create a ffdf data.frame
dat <- ffdf(x1=x, y1=x)
# create an ff index vector from a filter statement
idx <- ffwhich(dat, x1 < 5 & y1 > 2)
# use it to select data from the data.frame
dat[idx,][,]
# }

Run the code above in your browser using DataLab