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

ffmatch

Value Matching for ff objects


Description

ffmatch returns an ff vector of the positions of (first) matches of its first argument in its second. Similar as match.

ffdfmatch allows to match ffdf objects by paste-ing together the columns of the ffdf and matching on the pasted column and returns an ff vector of the positions of (first) matches of its first argument in its second.

%in% returns a logical ff vector indicating if there is a match or not for its left operand. ffdf objects are also allowed in the left and right operand of the %in% operator. See the examples.

Usage

ffmatch(
  x,
  table,
  nomatch = NA_integer_,
  incomparables = NULL,
  trace = FALSE,
  ...
)

ffdfmatch(
  x,
  table,
  nomatch = NA_integer_,
  incomparables = NULL,
  trace = FALSE,
  ...
)

x %in% table

Arguments

x

a ff object for ffmatch or an ffdf object for ffdfmatch

table

a ff object for ffmatch or an ffdf object for ffdfmatch

nomatch

the value to be returned in the case when no match is found. Note that it is coerced to integer.

incomparables

a vector of values that cannot be matched. Any value in x matching a value in this vector is assigned the nomatch value. For historical reasons, FALSE is equivalent to NULL.

trace

logical indicating to show on which chunk the function is computing

...

other parameters passed on to chunk

Value

An ff vector of the same length as x. An integer vector giving the position in table of the first match if there is a match, otherwise nomatch.

See Also

Examples

## Basic example of match.ff
x.ff <- ffmatch( as.ff(as.factor(c(LETTERS, NA)))
               , as.ff(as.factor(c("C","B","Z","X","HMM","Nothing",NA)))
               , trace=TRUE
               , BATCHBYTES=20)
class(x.ff)
x <- match(c(LETTERS, NA), c("C","B","Z","X","HMM","Nothing",NA))
table(x.ff[] == x, exclude=c())
## ffdfmatch also allows to input an ffdf
data(iris)
ffiris <- as.ffdf(iris)
ffirissubset <- as.ffdf(iris[c(1:10, nrow(iris)), ])
ffdfmatch(ffiris, ffirissubset, trace=TRUE, BATCHBYTES=500)

## %in% is masked from the base package
letter <- factor(c(LETTERS, NA))
check <- factor(c("C","B","Z","X","HMM","Nothing",NA))
letter %in% check
as.ff(letter) %in% as.ff(check)

ffiris %in% ffirissubset

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.