Skip to main content
Chemistry LibreTexts

1.1: Installing and Accessing R and RStudio

  • Page ID
    218844
  • Installing R and RStudio

    You can download and install R from the R-Project website. On the left side of the page, click on the link to CRAN under the title “Downloads.” Scroll through the list of CRAN mirror sites and click on the link to a site located near you. Versions are available for Mac OS, for Windows, and for Linux. Follow the directions for your operating system.

    You can download and install the RStudio Desktop Interface from the RStudio website. Click on the Download button for the free version of RStudio Desktop. From the list of available installers, click on the link that is appropriate for your operating system and follow the directions.

    Navigating RStudio

    When you launch RStudio, the program opens with the four panes as shown in Figure \(\PageIndex{1}\) (although some panes may be minimized).

    rstudio_panes.png
    Figure \(\PageIndex{1}\): A screenshot showing the arrangement of RStudio's four panes while I was working on Chapter 11. You can customize the arrangement of these panes by selecting RStudio: Preferences from the menu bar.

    Beginning in the lower left corner and moving clockwise, these panes are

    • the Console, which provides access to R; this is where you can directly enter commands as you work on problems.
    • the Source Pane, which provides access to a variety of different types of documents, including script files, which end with an extension of .R (more on these later). The source pane also provides a way to submit code to the console by highlighting the code and clicking on the Run button; this usually is a more efficient way to work.
    • the Environment & History Pane, which provides access to your data and the functions you create while using R.
    • the Files, Plots, Packages, Help & Viewer Pane, which provides access to your computer's file structure, to help files for R commands, to a list of R packages available to you (packages provide access to additional commands beyond those available to you when you first launch R; more on this in later chapters), to plots that you create, and to an internal web-like browser.

    As you work with R, take time to examine each pane so that you become comfortable with them. For example, Figure \(\PageIndex{1}\) shows my RStudio screen after I highlighted lines 15–21 in the script file "figures_11.R" and clicked Run, sending the lines of code to the console where R processed them to create the figure in the lower right pane.

    • Was this article helpful?