as.factor | R Documentation |
Convert column/columns in the current frame to categoricals.
as.factor(x)
x |
a column from an H2OFrame data set. |
as.factor
.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.