Learn R Programming

h2o (version 3.8.1.3)

h2o.ifelse: H2O Apply Conditional Statement

Description

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

Usage

h2o.ifelse(test, yes, no)

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

  • Returns 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
h2o.init()
ausPath = system.file("extdata", "australia.csv", package="h2o")
australia.hex = h2o.importFile(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