Skip to content

Instantly share code, notes, and snippets.

@edgararuiz-zz
Last active January 30, 2017 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save edgararuiz-zz/6453d44a91c85a87998cfeb0dfed9fa9 to your computer and use it in GitHub Desktop.
Save edgararuiz-zz/6453d44a91c85a87998cfeb0dfed9fa9 to your computer and use it in GitHub Desktop.
# The following two commands remove any previously installed H2O packages for R.
if ("package:h2o" %in% search()) { detach("package:h2o", unload=TRUE) }
if ("h2o" %in% rownames(installed.packages())) { remove.packages("h2o") }
# Next, we download packages that H2O depends on.
pkgs <- c("methods","statmod","stats","graphics","RCurl","jsonlite","tools","utils")
for (pkg in pkgs) {
if (! (pkg %in% rownames(installed.packages()))) { install.packages(pkg) }
}
# Now we download, install and initialize the H2O package for R.
install.packages("h2o", type = "source", repos = "http://h2o-release.s3.amazonaws.com/h2o/rel-turnbull/2/R")
# Installing 'rsparkling' from CRAN
install.packages("rsparkling")
options(rsparkling.sparklingwater.version = "2.0.3")
library(rsparkling)
# Reinstalling 'sparklyr'
install.packages("sparklyr")
library(sparklyr)
spark_install(version = "2.0.0")
# Connecting to Spark version 2.0.0
sc <- spark_connect(master = "local", version = "2.0.0")
h2o_context(sc)
library(dplyr)
mtcars_tbl <- copy_to(sc, mtcars, overwrite = TRUE)
mtcars_tbl
mtcars_hf <- as_h2o_frame(sc, mtcars_tbl)
mtcars_hf
spark_disconnect_all()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment