Learn R Programming

h2o (version 2.8.4.4)

h2o.addFunction: Adds an R function to H2O

Description

Add a function defined in R to the H2O server, so it is recognized for future operations on H2O. This method is necessary because R functions are not automatically pushed across via the REST API to H2O.

Usage

h2o.addFunction(object, fun, name)

Arguments

object
An H2OClient object containing the IP address and port of the server running H2O.
fun
A function in R. Currently, only a subset of the R syntax is recognizable by H2O, and functions that fall outside this set will be rejected. Values referred to by fun must be defined within H2O, e.g. a H2O dataset must be referred to by its k
name
(Optional) A character string giving the name that the function should be saved under in H2O. If missing, defaults to the name that the function is saved under in R.

Details

This method is intended to be used in conjunction with h2o.ddply. The user must explicitly add the function he or she wishes to apply to H2O. Otherwise, the server will not recognize a function reference that only exists in R.

See Also

h2o.ddply

Examples

Run this code
library(h2o)
localH2O = h2o.init()
h2o.addFunction(localH2O, function(x) { 2*x + 5 }, "simpleFun")

Run the code above in your browser using DataLab