Skip to content

Commit

Permalink
R: install from cran, other installation corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
Amy Wang committed Sep 5, 2014
1 parent 3655085 commit 7ad889b
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 193 deletions.
189 changes: 121 additions & 68 deletions h2o-docs/source/Ruser/Rinstall.rst
Original file line number Diff line number Diff line change
@@ -1,117 +1,170 @@
.. _Rfromdownload:
.. _R_Installation:

H\ :sub:`2`\ O Installation in R From Download Table
====================================================
Install H\ :sub:`2`\ O package in R
===================================

Currently there are three different ways to install the H\ :sub:`2`\ O package in R and depending on the build or version
of H\ :sub:`2`\ O the user wants to install one method will be more applicable than the others. The instructions below will
walk the user through download from CRAN, download from 0xdata website, and install from the most recent source code; all of
which makes the assumption that the R session is running R 2.13.0 or later.

These instructions assume you are using R 2.14.0 or later.
Regardless of whether installation is carried out in R Studio or R Console, the instructions are the same.
- 0xdata website has the most recent stable releases of H\ :sub:`2`\ O as well as the bleeding edge nightly build
- CRAN has a policy of updating packages every few weeks to months so the most recent or the last stable release would be available
- Git has most recent changes committed and a build will be made nightly from the source code, however stability is not guaranteed

**STEP 1**
Dependencies
""""""""""""
The H\ :sub:`2`\ O package is built with some required packages so in order to properly install H\ :sub:`2`\ O's package remember
to install the following dependencies all of which is available in CRAN:

The download package containing the H\ :sub:`2`\ O jar file can be
obtained by visiting H\ :sub:`2`\ O available downloads at
`http://0xdata.com/downloadtable <http://0xdata.com/downloadtable/>`_.
- RCurl
- bitops
- rjson
- statmod
- tools

Choose the version of H\ :sub:`2`\ O best for you, and unzip the
downloaded H\ :sub:`2`\ O zip file. The most recent promoted build is
recommended.

**STEP 2**
Download zip file from 0xdata.com
"""""""""""""""""""""""""""""""""

Start an instance of H\ :sub:`2`\ O. For help with this see
:ref:`GettingStartedFromaZipFile`
**Step 1**

If users do not start an instance of H\ :sub:`2`\ O, one will be
started automatically for them at localhost: 54321 (see **STEP 4** for
more detail).
Download one of the release from our `website <http://0xdata.com/download/>`_. The downloaded package will contain both the
H\ :sub:`2`\ O jar file as well as the R tar package file for R installation. After download completes, unzip the file and navigate to the
R subdirectory with the tar package.

If the instance of H\ :sub:`2`\ O is stopped, the R
program will no longer run, and work done will be lost.

**STEP 3:**

Follow the instructions for installation on the page from which the
package was downloaded. Those instructions will look similar to the
instructions in the picture below:

.. image:: buildindex.png
:width: 100 %


Note: users may get warnings of the type "Error in
detach("package:h2o", unload = TRUE): invalid 'name' argument.
This tells users that there is no H\ :sub:`2`\ O package to uninstall. These
warnings can safely be ignored.

::

**STEP 4:**
$ unzip h2o-2.7.0.1497.zip
$ cd h2o-2.7.0.1497/R
$ pwd
/c/Users/Amy/Downloads/h2o-2.7.0.1497/R

Once the H\ :sub:`2`\ O R package has been installed, call the
package, and establish a connection to a running instance of H\
:sub:`2`\ O.

If there is no running instance of H\ :sub:`2`\ O prior to using
the command "h2o.init()", H\ :sub:`2`\ O in R will start an instance
automatically for the user at localhost:54321, and the user will be
notified. If you would like to connect to an instance at an IP and
port other than localhost:54321, these details must be specified as
arguments in the R call.
**Step 2**

Start up R or Rstudio and install the R client package by running install.packages and inputting the location of the tar file. Finally load the library
and check that a simple demo script runs.

::

library(h2o)
localH2O <- h2o.init()
> install.packages("C:/Users/Amy/Downloads/h2o-2.7.0.1497/R/h2o_2.7.0.1497.tar.gz",
repos = NULL, type = "source")
> library(h2o)
> demo(h2o.glm)


Users who wish to specify a connection
with a server (other than localhost at port 54321) must explicitly
state the IP address and port number in the h2o.init call.
An example is given below, but **do not cut and paste**; users should
specify the IP and port number appropriate to their specific
environment.
Download R Package directly from 0xdata.com
"""""""""""""""""""""""""""""""""""""""""""

::
Navigate to one of releases available on our `website <http://0xdata.com/download/>`_. Select the *INSTALL in R* tab and follow the R code for installation.

library(h2o)
localH2O = h2o.init(ip = "192.555.1.123", port = 12345, startH2O = FALSE)


**STEP 5: Upgrading Packages**
.. image:: buildindex.png
:width: 100 %

Users may wish to manually upgrade their R packages. For instance, if
you are running the bleeding edge developer build, it’s possible that
the code has changed, but that the revision number has not, in which
case manually upgrading ensures the most current version of not only
the H\ :sub:`2`\ O code, but the corresponding R code as well.

This can be done by returning to STEP 3, and following the commands
through STEP 4.
::

# 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, install and initialize the H2O package for R.
install.packages("h2o", repos=(c("http://s3.amazonaws.com/h2o-release/h2o/master/1497/R", getOption("repos"))))
library(h2o)
localH2O = h2o.init()

# Finally, let's run a demo to see H2O at work.
demo(h2o.glm)



Download from CRAN
""""""""""""""""""

When downloading from CRAN keep in mind that the initial download from CRAN contain only the R package but when running h2o.init()
for the first time R will automatically download the corresponding H\ :sub:`2`\ O jar file, before launching H\ :sub:`2`\ O.

::

> install.packages("h2o")
> library(h2o)
> localH2O = h2o.init()

H2O is not running yet, starting it now...
Performing one-time download of h2o.jar from
http://s3.amazonaws.com/h2o-release/h2o/rel-knuth/11/Rjar/h2o.jar
(This could take a few minutes, please be patient...)


Make a build from Git
"""""""""""""""""""""

**Step 1**

For developers who want to actually make changes to the R package before building and installing it, start with pulling the
source code from `Git <https://github.com/0xdata/h2o>`_ and follow the instructions in :ref:`QuickstartGit`.

**Step 2**

Once a build has been made, navigate to the target directory and subsequently to the Rcran folder with the R package and run an install.

::

Amy@LENOVO-PC ~/Documents/h2o/target/Rcran (master)
$ R CMD INSTALL h2o_2.7.0.99999.tar.gz
* installing to library 'C:/Users/Amy/Documents/R/win-library/3.0'
* installing *source* package 'h2o' ...
** R
** demo
** inst
** preparing package for lazy loading
Warning: package 'statmod' was built under R version 3.0.3
Creating a generic function for 'summary' from package 'base' in package 'h2o'
Creating a generic function for 'colnames' from package 'base' in package 'h2o'
Creating a generic function for 't' from package 'base' in package 'h2o'
Creating a generic function for 'colnames<-' from package 'base' in package 'h2o'
Creating a generic function for 'nrow' from package 'base' in package 'h2o'
Creating a generic function for 'ncol' from package 'base' in package 'h2o'
Creating a generic function for 'sd' from package 'stats' in package 'h2o'
Creating a generic function for 'var' from package 'stats' in package 'h2o'
Creating a generic function for 'as.factor' from package 'base' in package 'h2o'
Creating a generic function for 'is.factor' from package 'base' in package 'h2o'
Creating a generic function for 'levels' from package 'base' in package 'h2o'
Creating a generic function for 'apply' from package 'base' in package 'h2o'
Creating a generic function for 'findInterval' from package 'base' in package 'h2o'
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Warning: package 'statmod' was built under R version 3.0.3
*** arch - x64
Warning: package 'statmod' was built under R version 3.0.3
* DONE (h2o)


**Step 3**

Check that H\ :sub:`2`\ O is install properly by running:

::

> library(h2o)
> localH2O = h2o.init()


Upgrading Packages
""""""""""""""""""

When upgrading H\ :sub:`2`\ O the user will need to upgrade their R package as well. In order to prevent a version mismatch, it is
recommended that users manually upgrade their R packages. For instance, if you are running the bleeding edge developer build,
it’s possible that the code has changed, but that the revision number has not, in which case manually upgrading ensures the most
current version of not only the H\ :sub:`2`\ O code, but the corresponding R code as well.

Simply detach the package and remove it from R before going through the installation process again:

::

if ("package:h2o" %in% search()) { detach("package:h2o", unload=TRUE) }
if ("h2o" %in% rownames(installed.packages())) { remove.packages("h2o") }

110 changes: 0 additions & 110 deletions h2o-docs/source/Ruser/Rinstallgit.rst

This file was deleted.

Binary file modified h2o-docs/source/Ruser/buildindex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion h2o-docs/source/Ruser/top.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ R On H\ :sub:`2`\ O
:maxdepth: 1

Rinstall
Rinstallgit
Rpackage
rtutorial
14 changes: 2 additions & 12 deletions h2o-docs/source/subjectindex.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _Subject_Index:

Index By Subject
=================
================

**Algorithms Roadmap**

Expand Down Expand Up @@ -99,11 +99,6 @@ Index By Subject

* :ref:`PCAmath`

**R Console**

* :ref:`Rfromdownload`
* :ref:`Rforgit`

**R**

* :ref:`R_user`
Expand All @@ -112,12 +107,7 @@ Index By Subject

* :ref:`R_pdf`

**R Studio**

* :ref:`Rfromdownload`
* :ref:`Rforgit`

**Random Forest**
**Random Forest**

* :ref:`RFmath`

Expand Down
Loading

0 comments on commit 7ad889b

Please sign in to comment.