Use R in the cloud

Download pdf file of this page

Introduction

This page provides a limited guide about how to how to run R via a cloud computing (serverless) option. For local installation of R onto a personal computer, please see Install R.

My suggestion for BI-311 students — use Google CoLaboratory. However, do explore each option to find your favorite way to interact with R in the cloud. For example, the sandbox options are great for testing code snippets.

Installation guides quickly become outdated. This page last updated 12 August 2025 and describes working installation protocols at that time.

Jump to quick links for different cloud environments

  1. myCompiler
  2. JupyterLite
  3. CoCalc by SageMATH
  4. Google CoLaboratory ← Dohm’s preferred choice
  5. RStudio in the cloud
  6. rdrr.io

Example R code snippet

Below you’ll find brief introductions to five different cloud options for running R. For your convenience, the example R code I run is listed below

myX <- c(1,2,3,4)
myY <- c(5,10,15,20)
plot(myY, myX)

Bonus: Since Descartes and the Cartesian coordinate system, by convention we place the X variable on the horizontal axis. Confirm and, if necessary, alter the provided code with smallest number of changes to yield a scatter plot with X variable on horizontal axis and Y variable on vertical axis.

Run R on your computer (ie, local development environment or LDE)

This page is about running R in the cloud, a server-less options. For installing R and R Commander onto your own computer (= your LDE option), see Install R and Install R Commander.

Note 1: You cannot install R Commander to any cloud server option. R Commander requires access to a local graphical display; in the cloud, all interactions between you and R are accomplished via the web browser.

Run R “in the Cloud”

If you do not wish to install R, or, if you have a ARM-based Chromebook and, therefore cannot gracefully install R, then there are alternatives; Run R in the Cloud. I’ll list five ways to run R in the cloud — run R on a server, not your own computer — for free.

Note 2: JupyterLite, Google CoLab, CoCalc, and RStudio in the Cloud offers a free version that is generally sufficient for BI-311 coursework. However, the free service has limitations, such as reduced computing resources, session timeouts, and occasional downtime. Paid CoLab Pro options are available but not required for this course. All exercises in this Workbook are designed to run on the free version.

If you have a Chromebook, or you want to run R on your tablet (iPad, Kindle, etc.), you can’t typically install R to any of these devices (see Linux distros for limited exception for some Chromebooks). However, you can access R via a serverless Cloud solution.

Note 3: myCompiler (#1), JupyterLite (#2), and rdrr.io (#6) are examples of code playgrounds or sandboxes. These are great for running small amounts of code — like solving a homework problem. Playgrounds shouldn’t be used for larger projects and you shouldn’t expect all R packages will run in playgrounds. The other disadvantage, you probably shouldn’t mount your Google drive in a code playground!

1. Run R code at Online R Compiler using myCompiler‘s online IDE, link at https://www.mycompiler.io/online-r-compiler. Example of myCompiler and R screenshot shown in Figure 1.

Screenshot myCompiler

Figure 1. Screenshot of myCompiler session.

myCompiler runs dozens of programming languages. MIT’s “Try It Online,” seems to be tops at this, with access to hundreds of programming languages, including Pascal — which takes me back to my graduate student days.

2. JupyterLite uses WebAssembly to run Python code within the browser. It’s a good option to try code snippets. Like all JupyterLab options, the default environment is Python. The home screen provide options to “launch” different coding environments and R is one of the options. In general, choose the Notebook options, although note that you can load and edit markdown files. For additional information about running R code relevant to Jupyter Notebooks see step 4a or step 4b below.

3. Run code snippets in CoCalc by folks at SageMath and available at https://cocalc.com/ . CoCalc uses Jupyter Notebooks, a wonderful, open-source project which supports interactive computer coding for many languages, including R and Markdown.

While CoLab is my go to, CoCalc is a really good student option — hint: I have my Systems Biology students use this option — includes SageMATH, python, GNU Octave and other software.

Create a free account (you’ll then be able to save your code), or simply click “Run CoCalc Now” and check the box to agree to the terms to begin a session (Fig 2). Choose to open a new Jupyter notebook, then select R (system wide) from the choice of kernels.

Screenshot CoCalc

Figure 2. Screenshot of CoCalc session.

You can load files from your computer for use in CoCalc sessions. There is also a version of the software you can download to your computer.

4. My favorite option for running R in the cloud is to run R code snippets at Google Colaboratory (Fig 3). Like CoCalc, Colaboratory uses Jupyter Notebooks. One real advantage of choosing CoLab, there are apps to run Google Colaboratory and Jupyter Notebooks on iPad/iPhone and for Android phones are available at Apple App Store and Google Play, respectively.

Note 4: Google CoLab runs python by default. Because the runtime resets with each session, you’ll need to reset the runtime to R each time, following these listed steps (4a). Alternatively, leave the python environment as is an run R commands via magic commands and rpy2.ipython extension (listed below at 4b).

4a. Setup CoLab for use in the cloud is straightforward, just four steps as of August 2025.

Screenshot or R session on Google Colab

Figure 3. Screenshot of Google Colab session.

Step 1. Log in to your Google account (or create one if you don’t already have one).

Step 2. Click the url link https://colab.research.google.com/#create=true&language=r , or try the short URL https://colab.to/r. Alternatively, if you prefer, here’s a qrcode (Fig 4).

QR code with url to create new R notebook in CoLab.

Figure 4. QR code with url to create new R notebook in CoLab.

Step 3. After creating a notebook, you’ll want to connect to your Google Drive to upload data files and script files, and to save files from R sessions.

# Install and load the functions needed to connect to Google drive
install.packages("googledrive")
library(googledrive)

# Authenticate your account
drive_auth(use_oob = TRUE)

The instructions call for you to click on web link and copy from the web page an authorization code (green arrow, Fig 5).

Screenshot of "Complete the Google auth process" page.

Figure 5. Screenshot of “Complete the Google auth process” page.

Copy the authentication code and paste it into the space provided on the colab notebook.

Step 4. You’ll want to rename and update the file name. Note in Figure 3 that the notebook name has the .ipynb file extension. Because we’re running R, don’t forget to change from the Python file extension to the .R file extension.

You’re ready to run your R code.

To confirm use of R as opposed to Python (the default language), from the menu bar select Runtime → Change runtime type and confirm R is the runtime type (Fig 6).

Screenshot, confirm R is the programming language in use by the Google Colab sesssion.

Figure 6. Screenshot, confirm R is the programming language in use by the Google Colab session.

After completing a session, hide code you do not want to share and print the notebook to a pdf file.

Colabs is worth the effort — you end up with a system to run R in your browser, it’s free to use, and you can store/retrieve files from your Google Drive. This is my choice for Cloud computing, and it’s the most generic solution. Starting in Fall 2025, we use Google CoLab in my biostatistics course at Chaminade University.

For more information about R and CoLab, see post by Ed Adityawarman, How to use R in Google Colab.

Colab Jupyter notebooks use Python by default. To run R, either use the link listed above each time you want to create a new R notebook, or add the following code snippet to your new notebook page

4b. Run R from within Python environment in your Jupyter Notebook by use of “magic”

# activate R magic - must begin each R code with %%R
%load_ext rpy2.ipython

For all subsequent R code, start the section with

%%R
myX <- c(1,2,3,4) 
myY <- c(5,10,15,20) 
plot(myY, myX)

Code and output displayed in Figure 7.

Note 5: %%R is for use with multiple lines of code. If only one line, then use %R.

Screenshot magic function rpy2 in use on GoLab, python environment.
Figure 7. Screenshot magic function rpy2 in action on CoLab, python environment.

Note 6: Jupyter Notebooks are a fantastic development in data science, particularly for collaboration. Although not a focus on my course, serious students may want to explore the Jupyter Notebook environment further (see Kluyver et al 2016). For example, you can install Jupyter onto your computer via Miniconda — conda is an open source package management system but then, you still would have to install R to your computer.

5. You can run RStudio at Posit Cloud. Registration and use is free for students. This works OK, but can be slow and it’s hard to work on your own data (free plan allows 25 projects and no more than 25 hours of computing time). It does have the advantage of providing the familiar RStudio interface. No doubt, RStudio is the predominate tool used by R programmers.

Choose the free plan; Instructions to get started are at https://posit.cloud/plans. You can link to your Google Drive in cloud version of RStudio via the googledrive package (introduced above with instructions for Google Colab).

A screenshot of an RStudio cloud session is shown in Figure 8.

screenshot RStudio Cloud session

Figure 8. Screenshot of RStudio at Posit Cloud session.

6. For limited use, ie, you just need to run a little code to solve an assignment problem, you can run R code snippets in your browser at rdrr.io/snippets/ (Fig 9). You’ll see many of my code embedded in this service so that you can run code snippets from my Chaminade University CANVAS pages.

screenshot R session at rdrr.io snippets

Figure 9. Screenshot of rdrr.io/snippets session.

References and additional resources

Kluyver, T., Ragan-Kelley, B., Pé, Rez, F., Granger, B., Bussonnier, M., Frederic, J., Kelley, K., Hamrick, J., Grout, J., Corlay, S., Ivanov, P., Avila, D., n, Abdalla, S., Willing, C., & Team, J. D. (2016). Jupyter Notebooks – a publishing format for reproducible computational workflows. In Positioning and Power in Academic Publishing: Players, Agents and Agendas (pp. 87–90). IOS Press. https://doi.org/10.3233/978-1-61499-649-1-87

Install R

This page has 30 images

Download pdf of this page

Introduction

The first time installing R can seem intimidating. To start, be clear about the overall goal of the procedure: providing the student with an accessible environment for solving statistics problems.

In brief, this page explains how to get R set up on your computer. First, you need to download the R installer from the official CRAN website. When you run the installer,in general, accept the default choices. However, for Windows users, it’s important to right-click the file and choose “Run as administrator.” This step ensures that R has the proper permissions to install correctly and avoids problems with user access later on. Once installed, you can open R and test it by typing a simple command like `2 + 2` in the console to confirm everything is working.

The flow chart presented in Fig 1 suggests a way to orient the student to solving the task. First, understand which type of computing environment you have available. Second, if a macOS, then additional software (XQuartz) is required to provide full function to the R software. Third, download and install the base R software appropriate for the computer system.

Figure 1 suggests an R installation flow chart.

An R install flow chart.

Figure 1. Suggested flow chart for R installation. 

Note 1: I skipped Linux in the flow chart — I’m working on the assumption that Linux users are more comfortable installing 3rd party software. However, some notes on R installs on Linux distros are included on this page.

It’s possible to follow the steps in Figure 1, accepting all default options presented along the way, to end up with a working R environment. As with many software processes, there are choices beyond defaults that can be made to improve the software use.

This page presents a detailed guide about how to install R onto your computer — this is referred to as building a local development environment or LDE. Additional install R help was provided in Chapter 1.1 – A quick look at R and R Commander.

Instructions for RStudio are also provided (optional for BI311 students). A guide to install R Commander is provided in Install R Commander.

Instructions for how to run R via a “cloud computing” (serverless) option — a remote development environment — are also provided, Use R in the Cloud.

Note 2: “Environment” has multiple meanings in computer science. While working with R, the environment refers to all the objects, variables, and functions available to the programming language (eg, Geeks for Geeks page). The context I’m using here refers to how a user accesses the programming language — the working computing environment. This would include software installed onto your computer (eg, local development environment), or in your browser pointed to a Cloud service (eg, a remote development environment).

For help upgrading installed packages after upgrading new R version, see R packages.

Note 3: Installation guides quickly become outdated. This page was created first in September 2019 and last updated August 2025 and describes working installation protocols at that time. As of August 2025, R -4.5.1 was current version. Instructions for Win10 and Win11 are the same. Instructions for Intel-based macOS are the same; with Apple’s switch to ARM64 (M1, M2, M3, M4), changes have been made. Going forward, the instructions on this page, but not my videos — version numbers need to be updated in the videos, are likely to be the same for new R versions. And wow! Search Google or Bing for “how to install R,” options in the millions. Ultimately the best source is in the R installation and administration manual.

Per usual caveat about this page of instructions: my advice is offered for instructional purposes and in no way implies warranty against damage or guarantee of success.

Run R on your computer (LDE install)

CoLab, skip this step: Instead, go to Use R in the cloud.

So why in this day in age should you install and build R on your own computer? The remote options to run R in the cloud are a wonderful option, convenient: you can access anywhere you have internet, from any device that connects to the internet. It’s easy to share and work together on projects, particularly those based on Jupyter Notebooks.

I think the main benefits to a local installation is it’s a more efficient environment to work in — you have control of everything and, provided your PC has power, a working R install on your computer will always be available to you. Since you can control the update cycle for your computer, you won’t run into times you cannot access the remote server to work on your project. Testing code is faster on a local install, feedback — think error messages — apply to your installed version. And, while remote R servers may come with low initial costs to students, any significant use will quickly require paid accounts. As a reminder, the good folks at the R-project continue to offer R as free software. All you need to do is work through the install process.

Start at the R-project homepage, r-project.org. To download software, first click on CRAN link,  located on left hand side of the screen (here, highlighted by green arrow, Fig 2).

Screenshot homepage for R-project.org

Figure 2. Screenshot homepage for R-project.org. 

Figure 3 shows a screenshot of the CRAN mirror page. The idea is to select the mirror site closest to your location. In Hawaiʻi, that’s likely to be any of the sites in California. However, I recommend selecting the first in the list, 0-cloud, at cloud.r-project.org (highlighted by green arrow, Fig 3).

Screenshot of portion of R-Project CRAN mirror page.

Figure 3. Screenshot of portion of R-Project CRAN mirror page.

Note 4: After installing R, see this page to learn how to set the CRAN mirror.

After selecting the mirror site, the download page is presented (Fig 4). Click on the link that corresponds to your computer system (Linux, macOS, or Windows).

Screenshot of portion of base R download page.

Figure 4. Screenshot of portion of base R download page.

Once the installation file is located onto your computer, proceed to install base R.

Detailed instructions

For screenshots of installation steps on WinPC, see Win10/11 setup, screenshots

  1. Windows PCs, download the base application from selected CRAN Mirror site, select Download R for Windows, and install the R software as you would any other software. All of you are likely to have the 64-bit version of Windows 11, so install the 64-bit version of R. Follow the instructions as they are presented. Screenshots of the install process are available at the end of this page (click here or scroll down to Win11 setup, Screenshots).
    • Current versions of Microsoft Windows come in several flavors, the simplest distinction is between home and pro. R runs perfectly well on both.
      • Windows 10 is reaching end of life cycle.
      • Some inexpensive Microsoft Windows PCs are built on ARM64, not Intel or AMD64 CPU. Thus, installing R and or RStudio may prove problematic.
      • Also note: Windows in S mode only run applications from the Microsoft store. To install R, you first may need to switch out of S mode (see Microsoft FAQ about S mode).
    • You should install R with Administrator privileges. Highlight the install file, right-click the file, and select “Run as administrator” from the popup menu.
    • When you first try to run R you may get a popup screen “Windows protected your PC,” locate and click on the “More info” link and select “Run anyway.”
      • This in no way will harm your computer — provided you have downloaded from official sites. R is a verified program. Microsoft has taken an aggressive line on developers and favors apps that are part of their app store.
      • It is advisable to confirm for yourself: check the md5sum against the fingerprint on the CRAN server
    • When prompted, I recommend that you change the install directory to root folder, e.g., C:\R\R-4.5.1. This will allow for installation of packages to the common library as opposed to a personal library.
      • I recommend this change because of how Windows assigns home folders. During initial setup Windows 10 prompted you to choose a username and whether you wanted your work stored locally or in your OneDrive folder. A worse case scenario? You select a username with spaces, e.g.,”Mike Dohm,” and you selected OneDrive. Both will cause challenges later for running and or installing packages for R.
        • If you install R anywhere but the default Program files folder on your Win10/11 PC, chances are you will need to add the folder containing the executable, r.exe, to you path.
          • Search: “env”
          • Open “Edit the system environment variables” in the Control Panel
          • Click Advanced tab, then click on Environment Variables… button (lower right of panel)
          • Under System variables, scroll to and select Path.
          • Click Edit… button, then click New button.
          • Type in the path to the folder containing R.exe. That’s likely to be C:\R\R-4.5.1, assuming R-4.5.1 is the latest version of R installed on your computer.
      • I made a video for you. Video is about 26 minutes long; at 22 minute mark, video includes how to install R Commander (instructions provided Install R Commander).
        • Apologies for the production quality — videos are not my thing.


https://youtu.be/upjmBieh3bM

For screenshots of installation steps on WinPC, see MacOS setup, screenshots

  1. macOS PCs, first you must download and install XQuartz from https://www.xquartz.org. Best to restart your mac after installing XQuartz then proceed to install R.
    After installing XQuartz, then return to https://cran.r-project.org, select Download for Mac(OS) X, and run the installer. Screenshots of the install process are available at the end of this page (click here or scroll down to Macos setup, Screenshots).

    • As of August 2025, be advised that there are two distinct R versions for your MacBook or iMac.
      • For MacBook or iMac with Apple’s M1 or M2 ARM chip sets, download and install R-4.5.1-arm64.pkg.
        • If you recently purchased a new MacBook or iMac (2020 to present), then you probably have the M2 or M3 chipset (check by clicking the Apple icon, then selecting About this Mac or System Information (/Applications/Utilities/System Information.app)).
        • XQuartz version 2.8.5 works on macs with either the M1 or Intel chipsets.
      • For older MacBook or iMacs with Intel processors, download R-4.5.1-x86_64.pkg.
      • Depreciated 8/4/2021: Be advised that these instructions are for Intel-based macs. At the time of writing these instructions (April 2021), the installation of XQuartz and R should work on new M1-based macs. At the time of this writing (April 2021), however, R will not run natively on your M1 mac. It will run using Rosetta 2, an emulator that is included with your M1 mac. The R folks are busy working on a version that will run natively, which may be ready within a few months.
    • At the completion of the install process, don’t forget to drag the R app to your Applications folder.
    • When you first try to run R, you may get a popup screen which provides no option to start the app, and perhaps even a rather ominous option to move the app to Trash. Just close the warning message and right-click on the R app. A new screen pops up, which looks very much like the previous warning, but now you will see and option to open the app. Click on open to start R.
    • Like the message to Windows PC users, bypassing Apple’s Gatekeeper to run R in no way will harm your computer — provided you have downloaded from official sites — R is a verified program. Apple has taken an aggressive line on developers and favors apps that are part of their app store.
  2. LINUX distros. If your PC platform is Linux, then you should be comfortable with installation and updating of software. R base is already included in Debian distributions (e.g., Mint, Ubuntu). See https://cloud.r-project.org/ for additional instructions.
    • For Chromebook users, if you can install a Linux subsystem, then you can also install and run R. For instructions to install R see Levi’s excellent writeup at levente.littvay.hu/chromebook/.

Note 5: To install up-to-date R and RStudio, your Chromebook needs to have Intel or AMD CPU; my ASUS Chromebook has an ARM64 processor (MediaTek mt8183), and Levi’s instructions don’t apply. As of January 2024 I am pushing the installation process a bit on my little Chromebook and have successfully created the Linux container (Debian 11, Bullseye) and installed base (and development) R version (4.0.4) included with the Linux distribution. Stay tuned — I’ll update progress with installing an R environment on ARM64-based Chromebook.

Update August 2025 — no change, very challenging to get R environment running and updated on ARM64 Chromebook. RStudio not possible.

Test R

For both macOS and Windows PCs, successful installation of R on your computer installs base R programming language and a simple graphical user interface. Test your install by running code in the terminal (one line at a time) or via script:

  1. Rgui.exe (Windows PC)
  2. File → New script

Enter code in script editor, e.g.,

myX <- c(1,2,3,4)
myY <- c(5,10,15,20)
plot(myY,myX)
  1. Run code: Ctrl+R

Figure 5 shows screenshot of R running on WinPC. RGui.exe (1), script editor (2), and results of plot() (3) on WinPC.

basic R with script editor on Win 10 PC

Figure 5. Screenshot of RGui.exe (1), script editor (2), and results of plot() (3) on WinPC.

  1. R.app (macOS): run code in the terminal or via script
  2. File → New Document

Enter code in script editor, e.g.,

myX <- c(1,2,3,4)
myY <- c(5,10,15,20)
plot(myY,myX)
  1. Run code: Cmd+Enter

Figure 6 shows screenshot of R running on macOS. R.app (1), script editor (2), and results of plot() (3).

basic R with script editor on macOS

Figure 6. Screenshot of R.app (1), script editor (2), and results of plot() (3) on macOS.

Many of you would like a video. Do a little search and you’ll find plenty, although most are also showing how to install RStudio in addition to base R.

Note 6: For my Biostatistics class, BI311, we typically will run R and use R Commander for scripting, without RStudio.

For BI311, we also use R Commander package

R Commander is a package that adds function to R; it provides a familiar point-and-click interface to R, which allows the user to access functions via a drop-down menu system (Fox 2017).

Go to Install R Commander guide.

Personalize R startup

At startup, R app looks to a series of environment files to instruct how it will provide a working session environment. One important file to know about is the .Rprofile file, which will reside in your home directory on your computer. This file generally won’t be present after the first installation, but can be easily added.

Note 7: .Rprofile is an example of a hidden file, and by default, these are hidden from the user view. On macs, to view hidden files in Finder, use keyboard short cut Cmd + Shift + . (the period key).  On Windows, to view hidden files in File Explorer, the keyboard shortcut is Ctrl + Shift + H.

First, verify the home directory where R will first look for an .Rprofile file.

Identify home directory

At the R prompt, verify your home directory, type and run

path.expand("~")

On a macOS, this should return something like

"~Users/USERNAME"

On a Windows 11 machine, this may return

"C:/Users/USERNAME/OneDrive/Documents"

if default instructions were accepted during initial Windows setup.

How to modify .Rprofile

Good practice suggests setting a project folder to contain work done for a project. For biostatistics students, minimally, this might be the course name, BIOSTATS. Within this folder we’d expect to find all course data files, homework, R coding scripts and related for the class. While it is easy enough to point R to a data file (see Part 07. Working with your own data, Mike’s Workbook for Biostatistics), it’s often easier to tell R in advance where to expect to find these files by setting a working folder at the beginning of a session using the setwd() command.

Alternatively, you can edit .Rprofile so that R always starts in the folder you want.

To open (or create if the first time) .Rprofile, at the R prompt type and submit

file.edit("~/.Rprofile")

Note 8: To confirm the .Rprofile is loaded, add to the top of the .Rprofile the following command.

options(test_success = "Success! .Rprofile is loaded.")

Then, when you start R type and submit the command

getOption("test_success")

should return

[1] “Success! .Rprofile is loaded.”

if successful.

Windows 11 Setup

  • Open your local home documents folder (usually C:\Users\YOUR_NAME\Documents).
  • Create or open a file named exactly .Rprofile (Ensure it does not end in .txt).

Copy this code for Windows:

.First <- function() {
# 1. Grab the literal, local hard drive user folder
local_root <- Sys.getenv("USERPROFILE")

# 2. Open a native Windows browse window for folder selection
message("Please select your local project folder...")
flush.console()

chosen_path <- choose.dir(
default = local_root,
caption = "Select your local project folder"
)

# 3. Set the directory to what they clicked on
if (!is.na(chosen_path)) {
setwd(chosen_path)
message("Working directory successfully set to: ", chosen_path)
} else {
warning("No folder selected. Working directory unchanged.")
}
}

macOS Setup

  • Ensure R.app has been granted Full Disk Access in your Mac’s System Settings > Privacy & Security.
  • Open Terminal and run open -a TextEdit ~/.Rprofile to open your profile configuration.

Copy this code for Mac:

.First <- function() {
# 1. Open a macOS Finder folder selection window
message("Please select your local project folder...")
flush.console()

# Calls native macOS AppleScript to open a secure folder picker
chosen_path <- tryCatch({
system("osascript -e 'POSIX path of (choose folder with prompt \"Select your local project folder:\")'", intern = TRUE)
}, error = function(e) {
return(NA)
})

# 2. Set the directory to what they clicked on
if (!is.na(chosen_path) && length(chosen_path) > 0) {
setwd(chosen_path)
message("Working directory successfully set to: ", chosen_path)
} else {
warning("No folder selected. Working directory unchanged. Keep in mind R.app needs 'Full Disk Access' in macOS System Settings.")
}
}

Note 9. R code for .Rprofile edits written with assist from Google AI.

Set your CRAN mirror site

To add function to R, you’ll download many R packages. These, too, are stored at the mirror sites. Each time you run install.packages(), R will ask for the mirror site. The R app on Windows pops up a long selection box; macOS R.app is a bit more friendly, but regardless, it’s best to choose a mirror site at the beginning of a session. At the R prompt, type and submit the command

options(repos = c(CRAN = "https://cloud.r-project.org"))

this will remain in effect for the current R session.

To make the change permanent, add to .Rprofile in your personal home directory

local({
r <- getOption("repos")
r["CRAN"] <- "https://cloud.r-project.org"
options(repos = r)
})

If you use textedit or notepad, make sure to return after the }); the file requires an empty new line to run.

Restart R, then enter at the prompt

file.exists("~/.Rprofile")

If you’ve created the Rprofile file correctly, R should repeat.

Run R from the terminal

Whether yours is a mac or win11 pc, you have a powerful computing environment lurking beneath the glossy graphic user interface. It’s called the terminal. The terminal is a place where text-based instructions may be written and submitted to command your computer to do something.

On win11 pc, the modern terminal is the Power Shell. Search “PowerShell,” then open Windows PowerShell. Alternatively, shortcut + X, then I key. This opens terminal in your home folder.

  • You’ll want to navigate to your working folder, e.g., BI311 on the Desktop. Setting your working folder can be done in R of course, but at the terminal type the command “cd \users\default\desktop\bi311“.

On macOS, Spotlight (search) “Terminal.app“. Alternatively, right-click on your working folder icon and select New terminal at Folder from the popup menu.

On Ubuntu Linux, shortcut keys + alt, then t key.

Open the included script editor

Use RStudio

Rstudio is a very popular data science IDE, specifically written for R programming. Therefore, if your goal is to become adept at R programming, go with RStudio. Like R Commander, Rstudio provides an environment to write an manage code, generate markdown reports, and importantly, manage files in R projects. Figure 7 shows a screenshot of RStudio: Clockwise, four panes: Source, Environment, Output, Console on WinPC. BI311 students, please note that I recommend use of R Commander and Google CoLab.

Screenshot Rstudio

Figure 7. Screenshot of RStudio IDE.

Installation of RStudio desktop is straightforward.

Go to https://posit.co/download/rstudio-desktop/

Install R first. Since at this point you’ve likely already installed R, go directly to 2 (green box, Fig 8).

Screenshot RStudio download page, September 2025.

Figure 8. Screenshot RStudio desktop download page, current as of September 2025.

After downloading the installation software, double click the file to begin. Follow on screen instructions for your computer system.

Run R in the “Cloud”

If you do not wish to install R, or, if you have a Chromebook and, therefore cannot gracefully install R, then there are alternatives; Run R in the Cloud. I’ll list three ways to run R in the cloud for free. Go to Use R in the Cloud guide.


MacOS setup, Screenshots

Download R install package from R-project.org, then select the R install package from your Download folder (Fig 9).

Note 10: The following screenshots were for previous R version 4.1.1. As of Fall 2025, current R version is 4.5.1. The screenshots are consistent between the current and older versions of R on macOS.

Screenshot -- Find the R install file in your download folder.

Figure 9. Screenshot — Find the R install file in your download folder.

First screen, R install for macOS (Fig 10). Select continue.

Screenshot: first instructions pop-up window.

Figure 10. Screenshot: first instructions pop-up window.

Second screen, R install on macOS (Fig 11). Select continue.

Screenshot: second instructions pop-up window.

Figure 11. Screenshot: second instructions pop-up window.

Third screen, R install on macOS (Fig 12). Select continue.

Figure 12. Screenshot: third instructions pop-up window.

Fourth screen, R install on macOS (Fig 13). Agree to continue.

Figure 13. Screenshot: fourth instructions pop-up window.

Fifth screen, R install on macOS (Fig 14). Select Install.

Figure 14. Screenshot: fifth instructions pop-up window.

Sixth screen, R install on macOS (Fig 15). Enter your username and password for your computer, then select Install Software.

Figure 15. Screenshot: sixth instructions pop-up window.

Seventh screen, R install on macOS (Fig 16). Several screens will popup, reporting progress. Be patient!

Figure 16. Screenshot: seventh instructions pop-up window.

Eighth and final screen, R install on macOS (Fig 17). Select close.

Figure 17. Screenshot: eighth and final instructions pop-up window.

Optional — Keep or discard the install file (Fig 18). I keep and then do manual delete after I’ve confirmed the installation.

Figure 18. Screenshot: MacOS will prompt with option to delete the installation file. This has no effect on the installation of R.

From Applications folder, start R.app. You should see the R Console (Fig 19).

Figure 19. Screenshot: R Console in the R.app on macOS.


Wind10/11 setup, screenshots

Download from R-project.org, then right-click the R install package from your Download folder. Run as administrator (Fig 20).

Note 11: The following screenshots were for previous versions of R, 3.6.1 and 4.0.5. As of Fall 2025, current R version is 4.5.1. The screenshots are consistent between the current and older versions of R on Windows 10/11.

Figure 20. WinPC  screenshot: Pop-up menu after right-click on the R installation file in windows Explorer.

First screen, select language (Fig 21). Select OK to continue

Figure 21. WinPC screenshot: first instructions pop-up window.

Second screen (Fig 22), click Next to continue

Figure 22. WinPC screenshot: second instructions pop-up window.

Third screen (Fig 23). Change the default location (show in the screenshot) to root folder, e.g., C:\R\R-4.5.1 (current version as of August 2025).

Figure 23. WinPC screenshot: third instructions pop-up window. Note — R-4.5.1 (current version as of August 2025).

Fourth screen (Fig 24). Change startup options. Select Yes (customized startup) to continue.

Figure 24. WinPC screenshot: fourth instructions pop-up window.

Fifth screen (Fig 25), select SDI — single document interface — not the default MDI — multiple document interface, then Next to continue.

Figure 25. WinPC screenshot: fifth instructions pop-up window. Recommend setting to SDI.

Sixth screen (Fig 26), select HTML help, then Next to continue.

Figure 26. WinPC screenshot: sixth instructions pop-up window.

Seventh screen (Fig 27), leave start menu folder as is (R), then Next to continue.

Figure 27. WinPC screenshot: seventh instructions pop-up window.

Eighth screen (Fig 28), check all boxes, then Next to continue.

Figure 28. WinPC screenshot: eighth instructions pop-up window.

Ninth screen (Fig 29), a series of status updates during the installation.

Figure 29. WinPC screenshot: ninth instructions pop-up window.

Final screen (Fig 30), successful install.

Figure 30. WinPC screenshot: final instructions pop-up window — successful installation.

/MD

1.1 – A quick look at R and R Commander

A first look at R.

R is a programming language for statistical computing (Venables et al 2009). R is an interpreted language — when you run (execute) an R program — the R interpreter intercepts and runs the code immediately through its command-line interface, one line at time. Python is another popular interpreted language common in data science. Interpreted languages are in contrast to compiled languages, like C++ and Rust, where program code is sent to a compiler to a machine language application. R is free to use and available via many platforms, from local installations on a person’s laptop to running on cloud servers (Fig 1). Flowchart showing R setup given operating system availability. Top blue box: "Linux, macOS, WinPC" leading to "Install R," branching into "R Commander" and "RStudio." Bottom red box: "ChromeOS, tablet, phone," leading to "Cloud computing," branching into "Google CoLab" and "Posit Cloud: RStudio." An "and/or" circle connects both parts.

Figure 1. Choose how you will interact with R: on your computer (Blue box) or in the cloud (Red box). Users of Linux, macOS, and WinPC can either install R to their computer or choose to access R in the cloud (and/or, black arrow).

Before you begin, you have a choice: how do you want to work with R (Fig 1)? In part, the choice depends on your computing device. If you have a desktop or laptop computer, running Linux, Apple macOS, or Microsoft Windows, then R can be installed onto your computer (blue box, Fig 1). If, however, you have a ChromeBook, Apple iPad or iPhone, or any Android Tablet or Smartphone, you would go with the second option (red box, Fig 1).

For those going with installing R to their computer, the second choice is to pick the environment for creating and running scripts and managing file input and output during a session. Working environments for R in the cloud include RStudio and Jupyter Notebooks (eg, Google CoLab) (red box, Fig 1 — see Note 2 below). For installed R, two suggested environments are R Commander and RStudio, an Integrated Development Environment or IDE, RStudio (Fig 1). The choice depends on your needs — an IDE is helpful when you plan to write a lot of code, it’s a comprehensive programming environment, which includes many tools that support writing code from scratch.

For our course at Chaminade University, I recommend R Commander because of the drop-down menu approach to accessing statistical functions in R; R Commander is not a comprehensive environment, but it provides the necessary scripting window along with access to markdown editing. R Commander, Rcmdr, is an R package that provide a graphical user interface or GUI for R. It is based on the tcltk package. R must be installed first before installing the R Commander package. R Commander provides familiar menu functions, like many commercial statistical software. R Commander, like the IDE RStudio, is not necessary for R programming or conducting statistical analysis or even generating reports via markdown. R Commander, however, shrinks the learning curve with R programming basics so that students can focus on learning statistics, which is the chief objective of the Biostatistics course at Chaminade.

The following steps user through use of R and R Commander, from installation to writing and running commands. Mike’s Workbook for Biostatistics has a ten-part tutorial, A quick look at R and R Commander, which I recommend.

Note 1: Getting started? By all means rely on Mike’s Biostatistics Book (Appendix: Install R, Install R Commander, Use R in the cloud) and blogs or other online tutorials to point you in the right direction. You’ll also find many free and online books that may provide the right voice to get you working with R. However, the best way to learn is to go to the source. The R team has provided extensive documentation, all included as part of your installation of R. In R, run the command RShowDoc("doc name"). replace doc name with the name of the R manual or R user guide. For example, the Venables publication is accessed as RShowDoc("R-intro"). Similarly, the manual for installation is RShowDoc("R-admin") and the manual for R data import/export is RShowDoc("R-data").

Install R.

Full installation instructions are available at Install R, and for the R Commander package, at Install R Commander. Here, we provide a brief overview of the installation process.

Note 2: The instructions at Mike’s Biostatistics Book assume use of  R on a personal computer running updated Microsoft Windows or Apple macOS operating systems. For Linux instructions, eg, Ubuntu distro, see How to install R on Ubuntu 22.04. For Chromebook users, if you can install a Linux subsystem, then you can also install and run R although it’s not a trivial installation. For instructions to install R see Levi’s excellent write up at levente.littvay.hu/chromebook/. (This works best with Intel-based CPUs — see my initial attempts with an inexpensive Chromebook at Install R.)

Another option is to run R in the cloud via service like Google’s Colab or CoCalc hosted by SageMath. Both support Jupyter Notebooks, a “web-based interactive computational environment.” Neither cloud-based service supports use of R Commander (because R Commander interacts with your local hardware). Colab is the route I’d choose if I don’t have access to a local installation of R. See Use R in the cloud for more details.

Download a copy of the R installation file appropriate for your computer from one of the Comprehensive R Archive Network (CRAN) mirror site of the r-project.org. For Hawaii, the most convenient mirror site is provided by the folks at RStudio (https://cloud.r-project.org/. In brief, Windows 11 users download and install the base distribution. MacOS users must first download and install XQuartz (https://Xquartz.org), which provides the X Window System needed by R’s GUI (graphic user interface). Once XQuartz is installed, proceed to install R to your computer. MacOS users — don’t forget to drag the R.app to your Applications folder!

Start R.

The following is a minimal look at how to use R and R Commander. Please refer to tutorials at  Mike’s Workbook for Biostatistics (R work, part 1 – 10) to learn use of R and R Commander.  

We’re just getting started, so the next thing to learn is how to set your working environment for your R sessions. Although we’ll discuss the R environment more as we proceed, it’s a good idea to start with a best practice action common in data science — always create and work from a working folder. This can be a local folder on your computer or pointed to a folder in your cloud storage. On my mac I usually create a folder on the desktop, example BI-311, and point to that as my working folder for a project. Now, we need to point R to use the working folder — we do this at start of each R session (or modify some code R needs during start up to always point to the folder — for now, we leave that for a later exercise). 

Once R is installed on your computer, start R as you would any program on your computer. For example, the icon for the R.app as it appears in the dock on a MacBook is shown in Figure 2.

Screenshot image of MacBook dock; from left to right, icons of Microsoft PowerPoint, the R app, and Microsoft OneDrive are shown.

Figure 2. R.app icon shown on a MacBook dock.

To point R to our working folder, there are several options. For now, we’ll go with writing and submitting a simple function in R. Recall that R has a command-line. The R prompt appears on the command line in the RGUI as the greater-than typographical symbol “>” at the beginning of a line (Fig 2). The prompt is returned by R to indicate the interpreter is ready to accept the next line of code.

First, discover where R is pointing to by submitting (type the command exactly as written then select keyboard shortcuts on Windows enter, or on macOS return key) the function getwd() at the prompt.

Note 3: Unfamiliar with keyboard shortcuts? I created a page just for you at Keyboard shortcuts in Mike’s Workbook for Biostatistics.

Ready to

On my MacBook, R returns

> getwd()
[1] "/Users/[username]/Documents"

To point to my working folder, I submit setwd("/Users/[username]/Desktop/BI311". When I run getwd() again, R returns the update

> getwd()
[1] "/Users/[username]/Desktop/BI311"

Note 4: Windows users will recognize that, unlike macOS and Linux, they will need to write paths with the backslash, not the forward slash. This is discussed further in Mike’s Workbook.

[username] is just a placeholder here — no reason to share my actual user name!

Ready to do some work?

R coding practices in this book and in the companion workbook roughly follow guidance outlined in a September 2018 R-Bloggers post, “R Code — Best practices,” by The R Trader. Of note, naming conventions: variables are nouns, variable names are written in lowerCamelCase; functions are verbs, function names are period separated, eg, my.function; script file names all end with .R and are written snake_case.R. Comments, preceded by #  and a single space, eg, # A brief comment, are sparingly included in code, but reserved for explanatory sentences in the text. We use <- and not = for assignment statements.

Where discussion requires reference to instructions on use of the R programming language, R code (instructions) the user needs to enter at the R prompt are shown in code blocks.

Courier New font within a “code block.”

Until you write your own functions, the general idea is, you enter one set of commands at a time, one line at a time. For example, to create a new variable, curryPoints, containing points scored by the NBA’s Steph Curry during the 2016 playoffs, type the following code at the R prompt (displayed as >, the “greater than” sign)

curryPoints <- c(24,6,40,29,26,28,24,19,31,31,11,18,19)

and to obtain the mean, or arithmetic average, for curryPoints at the R prompt type and enter

mean(curryPoints)

Output from R function mean will look like the following

[1] 24.42857

Functions in R, or any other data science programming language, are intended to automate a task.

Note 5: A good data management habit — store the variable as an R object called a data.frame.

df.curryPoints <- data.frame(curryPoints)

The R prompt appears in the RGUI as the greater-than typographical symbol “>” at the beginning of a line (Fig 3). The prompt is returned by R to indicate the interpreter is ready to accept the next line of code.

Screenshot of the R GUI on a macOS system; red arrow points to the R prompt. The visible code reads curry.points and some numbers between parentheses, next line calls for the mean of the object, and the last line begins with [1] and the result.

Figure 3. The R GUI on a macOS system; red arrow points to the R prompt.

Note 6: We just demonstrated one of several ways data can be brought into an R session, by creating a data.frame directly from a vector. Other methods include

  • Reading a text file from your computer, eg, CSV, by read.csv()
  • Importing a spreadsheet (Excel file) from your computer using readxl::read_excel()
  • Entering small datasets directly using read.table() with the text= argument

Everything that exists is an object.

A brief programmer’s note — John M. Chambers, creator of the S programming language and a member of the R-project team, once wrote that sub-header phrase about R and objects. What that means for us: programming objects can be a combination of variables, functions, and data structures. During an R session the user creates and uses objects. The ls() function is a useful R command to list objects in memory. If you have been following along with your own installed R app, then how many objects are currently available in your session of R? Answer by submitting ls(). Hint: the answer should be one object.

A routine task during analysis is to calculate an estimate then use the result in subsequent work. For example, instead of simply printing the result of mean(curryPoints), we can assign the result to an object. 

myResult <- mean(curryPoints)

To confirm the new object was created, try ls() again. And, of course, there’s no particular reason to use the object name, myResult, I provided! Like any programming language, creating good object names will make your code easier to understand.

When you submit the above code, R returns the prompt, and the result of the function call is not displayed. View the result by submitting the object’s name at the R prompt, in this case, myResult. Alternatively, a simple trick is to string commands on the same line by adding ; (semicolon) at the end of the first command. For example,

myResult <- mean(curryRoints); myResult

Objects created during an R session, like curryPoints, are stored in memory within the Global Environment. To remove an object, use the command rm(myVariable). Why remove objects during an R session? If you are attempting multiple tasks in a homework assignment, removing unneeded objects helps maintain a clean and organized workspace, improving code readability and reducing the chance of accidental errors. 

Write your code as script.

While it is possible to submit code one line at a time, a much better approach is to create and manage code in a script file. A script file is just a text file with one command per line, but potentially containing many lines of code. Script files help automate R sessions. Once the code is ready, the user submits code to R from the script file.

Note 7: Working with scripts eliminates the R prompt, but code is still interpreted one line at a time. The user does not type the prompt in a script file. 

Figure 4 shows how to create a new script file via the RGUI menu: File → New script.

Screenshot of drop down menu RGUI app, Windows 11. Highlighted items in the menu are File followed by New script.

Figure 4. Screenshot of drop down menu RGUI, create new script, Windows 11.

The default text editor opens (Fig 5).

Screenshot of portion of R Script editor, Windows 11. A simple R command, getwd() is visible.

Figure 5. Screenshot of portion of R Script editor, Windows 11. A simple R command is visible.

Submit code by placing cursor at start of the code or, if code consists of multiple lines, select all of the code, then hit keyboard keys Ctrl + R (Windows 11) or for macOS, Cmd + Enter.

I recommend starting with a clean environment, by using rm(list = ls()) at the beginning of a script.

By default, save R script files for reuse with the file extension .R, eg, my_script.R. Because the scripts are just text files you can use other editors that may make coding more enjoyable (see RStudio in particular, but there are many alternatives, some free to use. A good alternative is ESS).

Install R Commander package.

By now, you have installed the base package of the R statistical programming language (see for detailed instructions). The base package contains all of the components you would need to create and run data analysis and statistics on sets of data. However, you would quickly run into the need to develop functions, to write your own programs to facilitate your work. One of the great things about R is that a large community of programmers have written and contributed their own code; chances are high that someone has already written a function you would need. These functions are submitted in the form of packages. Throughout the semester we will install several R packages to extend R capabilities. R packages discussed in this book are listed at R packages of the Appendix.

Our first package to install is R Commander, Rcmdr for short. R Commander is a package that adds function to R; it provides a familiar point-and-click interface to R, which allows the user to access functions via a drop-down menu system (Fox 2017). Thus, instead of writing code to run a statistical test, Rcmdr provides a simple menu driven approach to help students select and apply the correct statistical test. R Commander also provides access to Rmarkdown and a menu approach to rendering reports.

install.packages("Rcmdr")

In addition, download and install the plugin 

install.packages("RcmdrMisc")

See Install R Commander for detailed installation instructions.

Note 8: Plugins are additional software which add function to an existing application.

Start R Commander.

After installing Rcmdr, to start R Commander, type library(Rcmdr) at the R prompt and enter to load the library

library(Rcmdr)

On first run of R Commander you may see instructions for installing additional packages needed by R Commander. Accept the defaults and proceed to complete the installation of R Commander. Next time you start R commander the start up will be much faster since the additional packages needed by R Commander will already be present on your computer.

Note that you don’t type the R prompt and, indeed, in R Commander Script window you won’t see the prompt (Fig 6). Instead, you enter code in the R Script window, then click “Submit” button (or Win11: Ctrl+R or for macOS: Cmd+Enter), to send the command to the R interpreter. Results are sent to Output window (Fig 6). 

Screenshot of the windows of R Commander running on macOS. From bottom to top: Messages, Output, Script (tab, Markdown) Rcmdr ver. 2.4-4. In the script window, the same code (create curry.points object, mean of the object) are displayed. The output window, results are shown. A large red arrow points to the Submit button. The Messages window shows the R Commander version information at start up.

Figure 6. The windows of R Commander, macOS. From bottom to top: Messages, Output, Script (tab, Markdown) Rcmdr ver. 2.4-4.

Figure 6 shows how the R Commander GUI looks on a macOS computer. The look is similar on Microsoft Windows 11 machines (Fig 7).

The windows of R Commander, Win11. From bottom to top: Messages, Output, Script (tab, R Markdown) Rcmdr ver. 2.5-1.

Screenshot of the windows of R Commander running on Windows 11. From bottom to top: Messages, Output, Script (tab, Markdown) Rcmdr ver. 2.5-1. In the script window, the same code (create curry.points object, mean of the object) are displayed. The output window, results are shown. Submit button is visible at right in the middle of the image. The Messages window shows the R Commander version information at start up.

Figure 7. The windows of R Commander, Win11. From bottom to top: Messages, Output, Script (tab, R Markdown) Rcmdr ver. 2.5-1.

We use R Commander because it gives us access to code from drop-down menus, which at least initially, helps learn R (Fox 2005, Fox 2016). Later, you’ll want to write the code yourself, and RStudio provides a nice environment to accomplish your data analysis.

Improve Rcmdr experience.

Windows users: R Commander works best in Windows if SDI option is set. This can be accomplished during R installation (“Startup options” popup, change from default “No” to “Yes” to customize), but you can also change after installing R. Win11 users should change from MDI to SDI — from one big window to separate windows — (see Do explore settings, WinPC see Fig 9; macOS see Fig 10). The downside of SDI is that while multiple Windows may appear during an R session, one or more windows may be hidden by an open window. For example, plots will popup in a new window and may be obscured by the Rcmdr window if full screen. A simple trick to view active windows on Win11 is to use the keyboard shortcut s Alt + Tab to view and cycle between windows. What about SDI and RStudio? RStudio experience will be similar whether MDI (default) or SDI was selected.

macOS users: To improve R Commander performance, turn off Apple’s app nap (see Do explore settings, Figures 6), which should improve a Mac user’s experience with R Commander and other X Window applications.

Complete R setup by installing LaTeX and pandoc for Markdown.

LaTeX is a system for document preparation. pandoc is a document converter system. Markdown is a language used to create formatted writing from simple text code.  Once these supporting apps are installed, sophisticated reports can be generated from R sessions, by-passing copy and paste methods one might employ. See Install R Commander for instructions to add these apps.

Note 9: If you successfully installed R and are running R Commander, but may be having problems installing pandoc or LaTeX, then this note is for you. While there’s advantages to getting pandoc etc working, it is not essential for BI311 work.

Assuming you have Rcmdr and RcmdrMisc installed, and if you have started Rcmdr and have it up and running, then we can skip pandoc and LaTeX installation and use features of your browser to save to pdf. 

R Markdown by default will print to a web page (an html document called RcmdrMarkdown.html) and display it in your default browser. To meet requirements of BI311 — you submit pdf files — we can print the html document generated from “Generate Report” in R Commander to a pdf.

  • Chrome browser, right click in the web page, from the popup menu select Print, then change destination to Save as pdf.
  • Safari browser, right click then select Print page (or if an option, Save page as pdf), then find at lower left find PDF and option to Save as PDF. 

R Markdown.

Markdown is a syntax for plain text formatting and is really helpful for generating clean html (web) files.  R Commander also helps us with our reporting. R Markdown is provided as a tab (Fig 6, Fig 7). Provided you have also installed pandoc on your computer, you can also convert or “render” the work into other formats including pdf and epub. Unsure if your computer has pandoc installed? If you are unsure than most likely it is not installed. 😁 Rcmdr provides a quick check — go to Tools and if you see Install auxiliary software, then click on it and a link to pandoc website to find and download installation file.  You can also confirm install of pandoc by opening a terminal on your computer (eg, search “terminal” on macOS or “cmd” on Win11), then enter pandoc –version at the shell prompt. Figure 8 shows version pandoc is installed on my Win11 HP laptop.

Screenshot of terminal window (cmd) on Windows 11 computer, checking for installed pandoc.

Figure 8.  Screenshot of terminal window (cmd) on win11 computer, checking for installed pandoc on a win10 pc.

Enter your R code in the script window, submit your code, and your results (code, output, graphs) are neatly formatted for you by Markdown. Once the Markdown file is created in R Commander, you can then export to an html file for a a web browser, an MS Word document, or other modes.

Do explore settings!

After installation, R and R Commander are ready to go. However, students are advised that a few settings may need to be changed to improve performance. For example, on Win11 PCs, R Commander recommends changing from the default MDI (Multiple Document Interface) to SDI (Single Document Interface).  Check the SDI button via Edit menu, select GUI preferences menu.  Click save, which will make changes to .RProfile, then exit and restart R. Check to make sure the changes have been made (Fig 9). 

Screenshot of GUI preferences settings for a Windows 11 installation of R. Changes visible include SDI from the default MDI, and multiple windows, not single window Pages style

Figure 9. Screenshot of GUI preferences settings after changing from default MDI to SDI, win10

For macOS users, both R and Rcmdr will run better if you turn off Apple’s power saving feature called nap. From Rcmdr go to Tools and select Manage Mac OS X app nap for R.app… (Fig 10).

Screenshot of the Tools popup menu in R Commander on a macOS 10.15.6 computer. No selections visible, but options include Load packages, Load Rcmdr plugins, Options, Save Rcmdr options, Manage Mac OS app nap for R.app, and Install auxiliary software.

Figure 10. Screenshot Rcmdr Tools popup menu, macOS 10.15.6

A dialog box appears; select off to turn off app nap (Fig 11).

Screenshot of "off" selected within Mac OS X app nap for R.app in Tool settings in R Commander context menu.

Figure 11. Screenshot Rcmdr Set app nap dialog box, macOS 10.15.6

Exit R Commander.

Click on Rcmdr: File → Exit, then choose to exit from just R Commander, or both R Commander and R.

If you exit just R Commander or both R and R Commander, you’ll receive a pop-up request to confirm you want to quit R Commander (click yes), and a second prompt asking if you want to save your script. In general, select yes and then you’ll be able to take up where you left off. Similarly, if asked to save your workspace, choose no. If you save workspace, this creates an .RProfile text file with settings for how R and R Commander will behave the next time you start R. The file will be saved to your current working folder, which R will use the next time R starts. At least while you are getting started, you should avoid creating these .RProfile files.

As long as the current session of R is active, then the library for Rcmdr, as well as any other library loaded during the R session, is in memory. To start R Commander again while R is running,  at the R prompt, type and submit

Commander()

Questions.

  1. Biostatistics students should work through my ten R lessons, A quick look t R and R Commander, available in Mike’s Workbook for Biostatistics.
  2. Students should also search Internet for R tutorials and R Commander tutorials. Find recent tutorials and work through several of them. We get better when we practice.

 

Quiz Chapter 1.1

A quick look at R and R Commander


Chapter 1 contents