Summer - 2024, University of Minnesota
It’s a programming language that can be used for a wide range of tasks.
Note
data.table for data wrangling, sf and terra for handling spatial data, etc.) are primarily written in other language such as C/C++ language, which makes their computation faster.Specifically,
Don’t worry!
The primary goals of this course is to provide you with the basic knowledge of R to conduct the following tasks:
Primary Goals
data.table packageggplot2 packagelm() and make a publish-ready regression table with modelsummary() packagefor loop function.You can use app to write and run R codes, but it has a terrible graphic user interface.
Rstudio is an another app build on top of R. It makes it much easier to edit R codes, see the results and organize the files.
But still, you need R to run Rstudio! R is the engine of Rstudio.
R studio looks like this:
To create new R script file, click the + button on the top-left corner of the Rstudio, or hit Ctrl + Shift + N (Cmd + Shift + N on mac).
To save the file, click the floppy disk icon , or Ctrl + S (Cmd + S on macOS).
You can change the appearance of Rstudio by going to Tools -> Global Options -> Appearance -> Editor theme and select your favorite theme.
You can have multiple code panes in Rstudio. To create a new pane, go to Tools -> Global Options -> Pane Layout -> Add Column. In the same window, you can also change the layout of the panes.
In the following image, I have two source panes. Also, I changed the layout of the panes.

Recent R-studio has a new feature called “Command Palette.”. Hit Ctrl + Shift + P (Cmd + Shift + P on macOS) on your keyboard. (or go to Tools -> Show Command Palette).
From the command palette, you can do anything!
Let’s write some codes.
R code
Ctrl + Enter (Cmd + Enter on macOS).Comment block
R will not run the code line starting with #. It’s called comment block. You can use it to write a note for yourself or others.
Note
See this link. for more information about Rstudio.
You don’t necessarily need to use R studio to use R (for example, you can use Visual Studio Code to run R), but, Rstudio is a great starting point to get familiar with R.