Learn R Programming

h2o (version 2.8.4.4)

h2o.table: Cross Tabulation of H2O Data

Description

Uses the cross-classifying factors to build a table of counts at each combination of factor levels.

Usage

h2o.table(x, return.in.R = FALSE)

Arguments

x
An H2OParsedData object with at most two integer or factor columns.
return.in.R
A logical value indicating whether the result should be converted into an R table.

Value

  • If return.in.R = FALSE, a H2OParsedData object containing the contingency table. This will just be the counts of each factor level when x has a single column. If return.in.R = TRUE, the H2O result will be pulled into R and converted into a table object.

Examples

Run this code
library(h2o)
localH2O = h2o.init()
prosPath = system.file("extdata", "prostate.csv", package="h2o")
prostate.hex = h2o.importFile(localH2O, path = prosPath, key = "prostate.hex")
summary(prostate.hex)

# Counts of the ages of all patients
head(h2o.table(prostate.hex[,3]))
h2o.table(prostate.hex[,3], return.in.R = TRUE)

# Two-way table of ages (rows) and race (cols) of all patients
head(h2o.table(prostate.hex[,c(3,4)]))
h2o.table(prostate.hex[,c(3,4)], return.in.R = TRUE)

Run the code above in your browser using DataLab