ifelse {SparkR}R Documentation

ifelse

Description

Evaluates a list of conditions and returns yes if the conditions are satisfied. Otherwise no is returned for unmatched conditions.

Usage

## S4 method for signature 'Column'
ifelse(test, yes, no)

Arguments

test

a Column expression that describes the condition.

yes

return values for TRUE elements of test.

no

return values for FALSE elements of test.

Note

ifelse since 1.5.0

See Also

when

Other normal_funcs: Column-class, column, column, column, column,character-method, column,jobj-method; abs, abs,Column-method; bitwiseNOT, bitwiseNOT, bitwiseNOT,Column-method; coalesce, coalesce, coalesce, coalesce,Column-method, coalesce,SparkDataFrame-method; expr, expr, expr,character-method; greatest, greatest, greatest,Column-method; is.nan, is.nan,Column-method, isnan, isnan, isnan,Column-method; least, least, least,Column-method; lit, lit, lit,ANY-method; nanvl, nanvl, nanvl,Column-method; negate, negate, negate,Column-method; randn, randn, randn, randn,missing-method, randn,numeric-method; rand, rand, rand, rand,missing-method, rand,numeric-method; struct, struct, struct,characterOrColumn-method; when, when, when,Column-method

Examples

## Not run: 
##D ifelse(df$a > 1 & df$b > 2, 0, 1)
##D ifelse(df$a > 1, df$a, 1)
## End(Not run)

[Package SparkR version 2.1.1 Index]