h2o.relevel: Reorders levels of an H2O factor, similarly to standard R's...

View source: R/frame.R

h2o.relevelR Documentation

Reorders levels of an H2O factor, similarly to standard R's relevel.

Description

The levels of a factor are reordered os that the reference level is at level 0, remaining levels are moved down as needed.

Usage

h2o.relevel(x, y)

Arguments

x

factor column in h2o frame

y

reference level (string)

Value

new reordered factor column

Examples

## Not run: 
library(h2o)
h2o.init()

# Convert iris dataset to an H2OFrame
iris_hf <- as.h2o(iris)
# Look at current ordering of the Species column levels
h2o.levels(iris_hf["Species"])
# "setosa"     "versicolor" "virginica" 
# Change the reference level to "virginica"
iris_hf["Species"] <- h2o.relevel(x = iris_hf["Species"], y = "virginica")
# Observe new ordering
h2o.levels(iris_hf["Species"])
# "virginica"  "setosa"     "versicolor"

## End(Not run)

h2o documentation built on May 29, 2024, 4:26 a.m.