For each subset of an H2O data set, apply a user-specified function, then combine the results. This is an experimental feature based on plyr::ddply.
h2o.ddply(X, .variables, FUN, ..., .progress = "none")
X | An H2OFrame object to be processed. |
---|---|
.variables | Variables to split |
FUN | Function to apply to each subset grouping. |
... | Additional arguments passed on to |
.progress | Name of the progress bar to use. #TODO: (Currently unimplemented) |
Returns an H2OFrame object containing the results from the split/apply operation, arranged
# NOT RUN { library(h2o) h2o.init() # Import iris dataset to H2O iris_hf <- as.h2o(iris) # Add function taking mean of Sepal.Length column fun <- function(df) { sum(df[, 1], na.rm = TRUE) / nrow(df) } # Apply function to groups by flower specie # uses h2o's ddply, since iris_hf is an H2OFrame object res <- h2o.ddply(iris_hf, "Species", fun) head(res) # }