Learn R Programming

h2o (version 2.8.4.4)

h2o.sample: Sample an H2O Data Set

Description

Sample an existing H2O Frame by number of observations.

Usage

h2o.sample(data, nobs, seed)

Arguments

data
An H2OParsedData object representing the dataset to sample.
nobs
The number of observations to be in the resulting frame.
seed
A seed for repeatable sampling.

Value

  • Returns an H2OParsedData containing `nobs` number of rows, sampled at random.

Examples

Run this code
library(h2o)
localH2O = h2o.init()
hex <- as.h2o(localH2O, iris)

# sample the data
a <- h2o.sample(hex, nobs = 99)

# check that the number of rows is 99
dim(a)

Run the code above in your browser using DataLab