h2o (version 2.4.3.11)

as.factor: Converts a column from numeric to factor

Description

Specify a column type to be factor (also called categorical or enumerative), rather than numeric.

Usage

as.factor(x)

Arguments

x
A column in an object of class H2OParsedData, or data frame.

Value

  • Returns the original object of class H2OParsedData, with the requested column specified as a factor, rather than numeric.

Examples

Run this code
library(h2o)
localH2O = h2o.init(ip = "localhost", port = 54321, startH2O = TRUE)
prosPath = system.file("extdata", "prostate.csv", package="h2o")
prostate.hex = h2o.importFile(localH2O, path = prosPath)
prostate.hex[,4] = as.factor(prostate.hex[,4])
summary(prostate.hex)

Run the code above in your browser using DataCamp Workspace