This tutorial is intended to teach users how to install R packages on Atmosphere (for a brief intro to Atmosphere you can view this video). These packages could be publicly available on CRAN (Comprehensive R Archive Network) or they could be packages developed for personal use. Although this tutorial is specific to R packages, many of the same principles also apply when installing other software on an Atmosphere instance.
Learn about CyVerse's allocation policies here.
In order to install an R package on an Atmosphere instance, some prep work must first be done.
Now that you have all the necessary software uploaded to your data store on CyVerse you're ready to launch your Atmosphere instance.
Once your instance has finished launching, Atmosphere will supply you with an IP address for accessing it. If you're using VNC Viewer to do this, make sure to append ":1" to the end of the IP address so that VNC knows which port to use. See Launching a New Instance.
If your R package is available on CRAN, this step if unnecessary and you should skip to Installing the R Package below.
Now that you have access to the base R image, you'll need to transfer all of the necessary files over to it. If you're using VNC Viewer, you have the option to use iDROP or CyberDuck for this. However, we will be using iCommands, which is far more reliable. For this tutorial we only have one file, randomForest_4.6-6.tar.gz, which is attached above.
Create a new folder in your home directory called "randomForest":
mkdir randomForest cd randomForest
iinit Enter the host name (DNS) of the server to connect to: data.iplantcollaborative.org Enter the port number: 1247 Enter your irods user name: myiplantusername Enter your irods zone: iplant Enter your current iRODS password: myiplantpassword
If you have a lot of files to transfer over to your instance, you can mount your Data Store by following the tutorial found here. However, since we only have one file to transfer, we will use the "iget" command to transfer a single file.
Once you have all of your files transferred over to your instance, you're ready to begin the installation process.
Launch R and install the R package. If the package is available on CRAN, use the first block of code. If you are using the file transferred in the last step, install it from source using the second block of code.
R install.packages("/iplant/home/myiplantusername/randomForest/randomForest_4.6-6.tar.gz", type="source")
R will ask you if it is okay to install the package in a personal directory. Say yes by typing "y" when prompted.
(Notice that the file path for the install package is different than the code mentioned above, make sure that your file paths are correct)
The R package should now be installed in the directory /home/myiplantusername/R/x86_64-unknown-linux-gnu-library/3.0/. We need to move it to /usr/local/lib/R/library.
sudo mv /home/myiplantusername/R/x86_64-unknown-linux-gnu-library/3.0/randomForest /usr/local/lib/R/library
Run the following command to verify that the package was installed correctly.
If no errors pop up, that means the package was successfully installed. You can now use the randomForest package (or whatever R package you installed) to perform whatever function you need. And if you like, you can request that your instance be imaged so that other iPlant users can benefit from your installation.
This step is optional.
Once you have verified that everything in your instance is working as intended, you're ready to request that it be imaged.
If you have any other files (e.g. documentation, readme files, etc.) that you want to be preserved, move them to a safe location that won't be wiped upon imaging (e.g. the /opt/ directory).
sudo mv /home/myiplantusername/randomForest/readme.txt /opt/randomForest/doc/
Once everything is in its correct place, you can return to Atmosphere's website and click the "Image" button. For more information on requesting imaging, see Requesting an Image of an Instance.