R/frame.R
Import R object to the H2O cloud.
as.h2o(x, destination_frame = "", ...) # S3 method for default as.h2o(x, destination_frame = "", ...) # S3 method for H2OFrame as.h2o(x, destination_frame = "", ...) # S3 method for data.frame as.h2o(x, destination_frame = "", ...) # S3 method for Matrix as.h2o(x, destination_frame = "", ...)
x | An |
---|---|
destination_frame | A string with the desired name for the H2OFrame. |
… | arguments passed to method arguments. |
Method as.h2o.data.frame
will use fwrite
if data.table package is installed in required version.
To speedup execution time for large sparse matrices, use h2o datatable. Make sure you have installed and imported data.table and slam packages. Turn on h2o datatable by options("h2o.use.data.table"=TRUE)
http://blog.h2o.ai/2016/04/fast-csv-writing-for-r/
use.package
# NOT RUN { h2o.init() hi <- as.h2o(iris) he <- as.h2o(euro) hl <- as.h2o(letters) hm <- as.h2o(state.x77) hh <- as.h2o(hi) stopifnot(is.h2o(hi), dim(hi)==dim(iris), is.h2o(he), dim(he)==c(length(euro),1L), is.h2o(hl), dim(hl)==c(length(letters),1L), is.h2o(hm), dim(hm)==dim(state.x77), is.h2o(hh), dim(hh)==dim(hi)) if (requireNamespace("Matrix", quietly=TRUE)) { data <- rep(0, 100) data[(1:10)^2] <- 1:10 * pi m <- matrix(data, ncol = 20, byrow = TRUE) m <- Matrix::Matrix(m, sparse = TRUE) hs <- as.h2o(m) stopifnot(is.h2o(hs), dim(hs)==dim(m)) } # }