-
Notifications
You must be signed in to change notification settings - Fork 1
Download and Install R and RStudio
R is a great program with lots of flexibility. It can be used as a standalone programing environment; however, for big projects or when you're learning R, it is best to use it with RStudio. R is still the engine that drives all of the processing and RStudio is mainly the organizational structure with which you interact in order to keep track of all of your work.
Watch the installation on YouTube.
Visit the CRAN site to download R from a nearby server (Mirror at Carnegie Mellon University). Under Download and Install R, you will select your operating system (linux, MacOS, or Windows). This is where your selections change slightly.
MacOS: We recommend the latest stable release of R that is compatible with your computer and operating system version. Please note that there are now different versions for Intel processors and Apple silicon processors. This will be in a .pkg file that you will download and open. You may have to change your security settings under system preferences, security and privacy, to open the download.
Windows: The next screen provides a few options. Select base for the first time installation. On the next screen, select the top choice, Download RX.X.X for Windows to begin the download of your executable .exe file. Open this file to complete the installation. You may also have to confirm that your download if your computer or browser attempts to prevent the download.
For both systems, it is recommended that you proceed with the default options for all of the installation questions. Please try to avoid any installation to OneDrive; this has caused problems in the past.
Visit the RStudio download page (under products) to download the program installer for your operating system. We will use the free RStudio Desktop IDE. MacOS users should download a disk image .dmg file and Windows users should download an executable .exe file. Again, follow the prompts for installation and accept the default options.
Open RStudio from the launchpad, applications folder, or start menu. The RStudio environment consists of a few panes. The default arrangement is that the file menu is on the lower right, the variable environment is on the upper right, and the left is the console. The console is sufficient for your test. As long as you are connected to the internet, you can issue the following command:
install.packages("ggplot2")
This is a package that includes additional plotting tools that will come in very handy. If that is successful, you will want to install a group of packages called tidyverse. These will be used in the workshop:
install.packages("tidyverse")
This may take a few minutes. After these are installed, try out R as a calculator:
5 + 4
[1] 9
Notice that the response comes on the next line.
There is a file in the repository called test.R. Open the file in RStudio or copy it to a new R script file. You can run the code line by line by clicking the "run" button on the top right of the new script window.
Limpopo Resilience Lab is a collaboration between University of Venda, Duquesne University, and Rensselaer Polytechnic Institute. More information on the project website.