Learn R Programming

h2o (version 2.4.3.11)

h2o.cut: Convert H2O Numeric Data to Factor

Description

Divides the range of the H2O data into intervals and codes the values according to which interval they fall in. The leftmost interval corresponds to level one, the next is level two, etc.

Usage

h2o.cut(x, breaks)

Arguments

x
An H2OParsedData object with numeric columns.
breaks
A numeric vector of two or more unique cut points.

Value

  • A H2OParsedData object containing the factored data with intervals as levels.

Examples

Run this code
library(h2o)
localH2O = h2o.init(ip = "localhost", port = 54321, startH2O = TRUE)
irisPath = system.file("extdata", "iris_wheader.csv", package="h2o")
iris.hex = h2o.importFile(localH2O, path = irisPath, key = "iris.hex")
summary(iris.hex)

# Cut sepal length column into intervals determined by min/max/quantiles
sepal_len.cut = h2o.cut(iris.hex$sepal_len, c(4.2, 4.8, 5.8, 6, 8))
head(sepal_len.cut)
summary(sepal_len.cut)

Run the code above in your browser using DataLab