Difference between revisions of "R Programming - Getting Started"
(→Packages) |
|||
Line 17: | Line 17: | ||
==Packages== | ==Packages== | ||
+ | ''Note - before trying to install a package, first try to load it with the library command. If it isn't installed, then you try to install it. See next...'' | ||
+ | |||
One of the best features of R is the large number of very good packages that are easy to install and use. Once you have downloaded and installed R and Rstudio and open up Rstudio, you can download and install packages using the install.packages command. For example, here is the command to install openxlsx, you would run the following. | One of the best features of R is the large number of very good packages that are easy to install and use. Once you have downloaded and installed R and Rstudio and open up Rstudio, you can download and install packages using the install.packages command. For example, here is the command to install openxlsx, you would run the following. | ||
<pre> | <pre> |
Revision as of 03:11, 22 May 2019
So you want to learn R programming. Good for you. This page will hopefully walk you through getting into R.
Contents
Reading
There are numerous good tutorials, getting started, and so forth for R. Reading through just about any of them is good for you. Here are a few you can try, but feel free to pick your own as well.
- R Tutorial on TutorialsPoint - mostly a high level overview, many parts suitable for people with very limited programming experience.
- R Manuals - from the official R website, these tend to be more in depth and aimed at an audience who already has some programming experience.
- R Getting Started - summary / intro by Jeff Kinne
Software Setup
R is free to use and has numerous free packages as well. We recommend using the Rstudio IDE since it is the most popular and has some very nice features.
Install on Your Computer
- Download and install the latest version of R from https://cloud.r-project.org
- Download and install Rstudio deskttop (the free version) from https://www.rstudio.com/products/rstudio/download/
Use on ISU CS Systems
To use R on the ISU CS systems, you can either use Rstudio when you are in one of the labs or run R from the terminal when you are logged in remotely. To run Rstudio on one of the CS lab computers, simply run the rstudio command (either from a terminal, or via the graphical menu). To run R from a terminal, simply run the R command.
Packages
Note - before trying to install a package, first try to load it with the library command. If it isn't installed, then you try to install it. See next...
One of the best features of R is the large number of very good packages that are easy to install and use. Once you have downloaded and installed R and Rstudio and open up Rstudio, you can download and install packages using the install.packages command. For example, here is the command to install openxlsx, you would run the following.
install.packages("openxlsx")
You only need to run this once on your computer. Once it is installed, you use the library command to load the package so it is available for use.
library("openxlsx")
Many packages related to biology and medicine are installed a little differently, using a system called Bioconductor. You first must install the R Bioconductor by running the following.
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager")
Once this is complete, you can install a Bioconductor package (here the package edgeR) as follows.
BiocManager::install("edgeR")