
January 22, 2024 @ 09:17 PM

Many of the images are quick screengrabs and may look less than their best resolution when reduced in size. You can right-click (or the Mac equivalent) on any image to open it to its full size or to save it to your own computer.
Now let’s explore! Log into your ASU Rstudio server account.
R is a programming language that runs computationsR

Analogy of the difference between R and RStudio (from Modern Dive)
An integrated development environment (IDE) is software that combines common tools into a single graphical user interface (GUI). Common components include:
RStudio isn’t the only IDE for R, but it is one of the most widely used. Like the textbook Modern Dive says, R is like the engine and RStudio is the dashboard that lets us drive the car. We can also add packages to “soup up” our engine.

The slides you’re looking at right now were created in RStudio using R Markdown that was “knitted” into standalone HTML.
Many of our online textbooks were produced the same way!
Your RStudio server will look something like this, except your Console pane (what is that, you ask?) will be on the left.
There are four “panes” in the RStudio interface.
Console pane (this is the R engine)
Environment pane
Files/Plots/Packages/Help pane
Source Editor (coding/document) pane
You can rearrange these panes to suit your own preferences. We will talk more about that shortly…
The first time you log into the RStudio server, you will not have a Source Editor. We will talk about how to create new code scripts and R Markdown documents for you to code in.

The four panes of RStudio (from YaRrr! The Pirate’s Guide to R)
After we open a script or R Markdown file to edit code, you will see all four panes. The default position is the upper left corner.
This menu is much like any windows program — File > New File.
The file extension on an script is .R, but it is just a plain text file. Notice the set of options in the pane’s menu bar.
The file extension is .Rmd, but it is also basically just a plain text file. The difference is in the processing. Notice the options in the pane’s menu bar—they are different than a script.


Quarto is a free and open-source scientific / technical publishing system. From its website…
“Quarto is a multi-language, next generation version of R Markdown from RStudio, with many new features and capabilities. Like R Markdown, Quarto uses Knitr to execute R code, and is therefore able to render most existing Rmd files without modification.”
Quarto also integrates with Python (plus other languages) and a popular IDE from Jupyter.
We are primarily going to use R Markdown documents in this class. If you learn that, then you’ll be equipped to expand your skills later. That’s one big fact of data science: you never stop learning because it never stops evolving (and quickly)!
One of our goals in STT 2860 will be to learn how to learn…

We will set some options that make RStudio work better for us in our class environment. You will find the menu under Tools > Global Options. (Also open Customizing the RStudio IDE.)
You can change the editor theme and font size in RStudio to the settings that are most effective for you.
The different colors in the Source pane are intended to help you code by visually distinguishing different parts of the code.
For example, functions will be one color and strings of text that are inside quotation marks will be another color. Text formatting like italics also will be a different color.
Go to Tools > Global Options > Appearance in the toolbar.
I like a dark theme with somewhat muted colors called "Tomorrow Night".
Choose a theme you like. You can also change your font size.
I like my Console to be on the upper right, so I can maximize the Source and Console panes at the same time, and so code “flows” left to right. You can choose what works for you.
The most important thing to do here is unclick “Restore .Rdata into workspace at startup” and also change “Save workspace…” to Never. Failing to do this can cause issues with your account.
Many of the settings are intended to make programming easier.
How features like the cursor behave
Suggestions and auto-completion for code
Multi-colored parenthesis to help with matching
Additional styling suggestions for enhancing readability
As your data science skills evolve, you may want to adjust your RStudio settings.
Finding what works best for you requires some trial and error.
Comment/Uncomment Lines and Reindent Lines are helpful!
Sometimes when R is behaving in an inexplicable way, you may need to save your work and restart your R session. Yes…this is basically turn it off and back on again ;)
There are several “cheat sheets” available. You can also view all the keyboard shortcuts here, get help with simple R Markdown formatting, or turn on accessibility options.
At first, things might feel a little like this…

But I can tell you from past experience that most folks succeed in STT 2860 if they come and engage with an open mind.

Command History in the RStudio IDE
Editing and Executing Code in the RStudio IDE
Keyboard Shortcuts in the RStudio IDE
Working in the Console in the RStudio IDE
Cartoon illustrations: Artwork by @allison_horst