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

ffextract

Reading and writing vectors extended to handle logical ff vectors as indexes


Description

Package ff does not allow to extract and set values of ff vectors based on logical ff vectors. For this reason the extractor functions [.ff and [<-.ff defined in package ff are overloaded.
If you supply a logical ff vector as an index to another ff vector, the overloaded function will convert it to an integer ff. index before using the [.ff and [<-.ff function from the ff package.
This allows to do ff(1:10)[ff(c(FALSE, TRUE, NA, TRUE))]

Mark that all other functionality from the extractor functions [.ff and [<-.ff in package ff are retained. This is an extension to handle logical ff vectors as indexes.

Usage

## S3 method for class 'ff'
 x[i, pack = FALSE]

## S3 replacement method for class 'ff'
 x[i, add = FALSE, pack = FALSE] <- value

Arguments

x

an ff object

i

missing OR a single index expression OR a hi object

pack

FALSE to prevent rle-packing in hybrid index preprocessing, see as.hi

add

TRUE if the values should rather increment than overwrite at the target positions, see readwrite.ff

value

the values to be assigned, possibly recycled

Value

See Extract.ff. Mark that if a logical ff vector is used for i, and if only FALSE or NA values are present, NULL is returned in case of the extractor function [.ff while for the setter function [<-.ff, if the length value is zero, this is not allowed.

See Also

Examples

## extractors
x <- ff(1:10)
y <- ff(11:20)
idx <- ff(c(FALSE, TRUE, NA, TRUE))
x[idx]
idx <- ff(c(FALSE, FALSE, TRUE))
x[idx]
idx <- ff(1:3)
x[idx]

## setters
idx <- ff(c(FALSE, TRUE, NA, TRUE))
x[idx] <- y[idx]
x
idx <- ff(c(FALSE, FALSE, TRUE))
try(x[idx] <- y[idx], silent = T) ## not allowed
x
idx <- ff(1:3)
x[idx] <- y[idx]
x

ffbase

Basic Statistical Functions for Package 'ff'

v0.13.3
GPL-3
Authors
Edwin de Jonge, Jan Wijffels, Jan van der Laan
Initial release

We don't support your browser anymore

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