Getting Started with the RStudio Server

Running R locally

You can also run RStudio on your local machine. The software is free and simple enough to download and install. But I encourage you to give the server a try and then decide what workflow is best for you.

One advantage of working on the server is that all the required packages and utilities will already be installed and ready for use. If you work locally, you will need to install these things yourself.

Logging in to posit Workbench

Go to https://r.cs.calvin.edu and enter your normal Calvin user name and password to log in.

Logging in to posit Workbench

Select RStudio Pro

posit Workbench includes some other things that we won’t need for this class (Jupyter notebooks, etc.). Just ignore those and select RStudio (Pro).

Start (or resume) a session

Starting a new session

If you don’t already have an RStudio session going, you will need to create a new session. Click to create a new session, and then select R Studio Pro as the session type.

On the next screen, just accept the defaults by clicking on New Session and after a short delay, you should be ready to go.

Resuming a previous session

If you already have a session, then you can just select it to resume where you left off.

Getting Started with RStudio

Local vs Server

Whether you are running RStudio locally or using the RStudio Pro server, things will be very similar from this point. The main difference to remember is that the server is not running on your local machine but as a cloud service. So you may need to upload things to the server or download them from the server from time to time.

Panes

Once you get to your RStudio session, you will see that RStudio is organized into 4 panels or panes. Each of the panes can have multiple tabs.

Note: Panes may be closed

Sometimes some of the panes are closed, so you may only see 2 or 3 of them. (Use the icons in the upper right of each pane to open or close it.)

Also, you can rearrange what appears in each pane, so the location of things may be different in your session than in the examples shown here or elsewhere.

One pane contains the Console. Another contains Environment, History and maybe more tabs. A third pane has tabs labeled Files, Plots, and Packages. Explore a little to try to get familiar with them!

  • Files shows you the files saved in your personal space on the server. You can organize, upload, and delete files and folders.

  • Console is where you can type commands. Go ahead and give that a try (but we are going to learn a better way in just a moment). Type some simple arithmetic like 2 + 2 and see if you get the correct answer.

  • Plots, not surprisingly, is where plots show up.

  • Viewer is where other sorts of documents might appear for viewing – like our rendered quarto document. (You have the option of having these show up in a separate window, which might be useful if your screen is small and you don’t mind having extra windows open, or if you have duel monitors and want to have the rendered document on a different monitor from your RStudio session.)

  • Environment shows you the data sets, functions and other variables that you have defined and are available for use in the console. (The little broom is for clearing your environment, which can be good to do from time to time to reduce clutter.)

  • History has a record of past R commands that you executed in the console. It’s even searchable.

Executing R code

You can do things in R by typing commands in the Console panel; however, working that way makes it hard to keep a record of your work (and hard to redo things if anything changes or if a mistake was made). Using R Markdown or Quarto files, which can contain text, R code, and R output (including figures) is a better way to go for most purposes.

A few settings you might like to adjust

You can change settings by navigating to Tools > Global Options.

There are many configurable options, here a few that you might consider adjusting.

  • Code
    • If having RStudio insert matching parentheses and quotes annoys you, you can turn that off.
  • Appearance
    • Here you can choose colors, fonts, themes, etc. Want dark mode? Need a larger or smaller font? Here’s the place to tweak how things look.
  • Pane Layout
    • You can decide which panes and tabs you like where.
  • R Markdown
    • Choose to show document previews in the Viewer pane or in a separate window.
  • Spelling
    • You can edit your user dictionary to, for example, include your name.