Created
January 30, 2017 20:40
-
-
Save edgararuiz-zz/692a460b5f60848ddb22b963120561e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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-turing/7/R") | |
# Installing 'rsparkling' from CRAN | |
install.packages("rsparkling") | |
options(rsparkling.sparklingwater.version = "1.6.8") | |
library(rsparkling) | |
# Reinstalling 'sparklyr' | |
install.packages("sparklyr") | |
library(sparklyr) | |
spark_install(version = "1.6.0") | |
# Connecting to Spark version 1.6.0 | |
sc <- spark_connect(master = "local", version = "1.6.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