as.factor: Convert H2O Data to Factors

Description Usage Arguments See Also Examples

View source: R/frame.R

Description

Convert column/columns in the current frame to categoricals.

Usage

1

Arguments

x

a column from an H2OFrame data set.

See Also

as.factor.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
library(h2o)
h2o.init()

# Single column
cars <- "https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv"
df <- h2o.importFile(cars)
df["cylinders"] <- as.factor(df["cylinders"])
h2o.describe(df["cylinders"])

# Multiple columns
cars <- "https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv"
df <- h2o.importFile(cars)
df[c("cylinders","economy_20mpg")] <- as.factor(df[c("cylinders","economy_20mpg")])
h2o.describe(df[c("cylinders","economy_20mpg")])

## End(Not run)

h2o documentation built on Oct. 10, 2021, 1:08 a.m.