ffbase (version 0.12.8)

ffifelse: Conditional Element Selection for ff vectors.

Description

Similar as ifelse in the base package but only works with yes and no as ff vectors.

Usage

ffifelse(test, yes, no)

Arguments

test

logical or boolean ff vector

yes

an ff vector with return values for true elements of test. If too short, their elements are recycled.

no

an ff vector with return values for false elements of test. If too short, their elements are recycled.

Value

An ff vector of the same length as test.

See Also

ifelse

Examples

Run this code
# NOT RUN {
data(iris)
ffiris <- as.ffdf(iris)
ffifelse(ffiris$Sepal.Length < 5, TRUE, NA)
ffifelse(ffiris$Sepal.Length < 5, factor(rep("abc", nrow(ffiris))), NA)
ffifelse(ffiris$Sepal.Length < 5, Sys.Date(), factor("abc"))
ffifelse( ffiris$Sepal.Length < 5, Sys.Date(), ff(seq.Date( Sys.Date()+1
        , Sys.Date()+nrow(ffiris), by = "day")))


# }

Run the code above in your browser using DataCamp Workspace