Learn R Programming

h2o (version 2.8.4.4)

ifelse: Applies conditional statements to an H2OParsedData object.

Description

Applies conditional statements to numeric vectors in H2O parsed data objects when the data are numeric.

Usage

ifelse(test, yes, no)

Arguments

test
A logical description of the condition to be met (>,
yes
The value to return if the condition is TRUE.
no
The value to return if the condition is FALSE.

Value

  • Retruns a vector of new values matching the conditions stated in the ifelse call.

Details

Only numeric values can be tested, and only numeric results can be returned for either condition. Categorical data is not currently supported for this funciton and returned values cannot be categorical in nature.

Examples

Run this code
library(h2o)
localH2O = h2o.init()
ausPath = system.file("extdata", "australia.csv", package="h2o")
australia.hex = h2o.importFile(localH2O, path = ausPath)
australia.hex[,9] <- ifelse(australia.hex[,3] < 279.9, 1, 0)
summary(australia.hex)

Run the code above in your browser using DataLab