1Objectives¶
By the end of this lesson you will be able to:
Choose between installing R + RStudio locally and using the CSUB JupyterHub, based on your own device and needs.
Install R, RStudio, and this book’s packages on your own computer.
Access the CSUB JupyterHub and open a notebook with R already running.
Compare the two options and know when to use each.
2Two ways to run R¶
You do not have to choose only one. Most people end up using both at different points in a term.
| Install locally (R + RStudio) | CSUB JupyterHub | |
|---|---|---|
| Setup required | Install two programs, once | None — a web browser is enough |
| Works offline | Yes | No — needs internet |
| Works on a shared/lab/library computer | Only if you can install software | Yes |
| Where your work is saved | Your own computer | The JupyterHub server (csub.jupyter.cal-icor.org) |
| Good for | Homework at home, projects, keeping R long-term | Labs, quick checks, any device without admin rights |
This book’s packages (mosaic, BSDA) | You install once (below) | Pre-installed for you |
3Option A — Install R and RStudio on your own computer¶
R and RStudio are two separate, both free, downloads. R is the language and engine that actually runs your code; RStudio is an application (an “IDE,” integrated development environment) that makes working in R much more comfortable — it adds a code editor, a place to see your data and plots, and menus for common tasks. You need both; RStudio does nothing without R installed underneath it.
Step 1 — Install R. Go to the Comprehensive R Archive Network (CRAN) at cran.r-project.org and choose the installer for your operating system (Windows, macOS, or Linux). Run the installer with the default options. This book is built and tested on R 4.5.2 — any recent 4.x release will work, but if you can choose, prefer the newest stable release CRAN offers.
Step 2 — Install RStudio Desktop.
Go to posit
Step 3 — Open RStudio and install the course packages. Open RStudio (not R by itself). In the Console pane (usually bottom-left), type the following and press Enter:
install.packages(c("mosaic", "BSDA"))This single line downloads and installs both packages this book uses —
mosaic (with its ggformula plotting layer, plus dplyr and other helpers
it pulls in automatically) and BSDA — from CRAN. It can take a minute or
two the first time; you’ll see download and compilation messages scroll by,
and it’s done when you get your prompt (>) back with no red Error text.
You only need to run install.packages() once per computer — after
that, L05 shows you the much shorter library() line you run at
the start of every session.
4Option B — The CSUB JupyterHub (nothing to install)¶
CSUB provides a hosted, browser-based platform — JupyterHub — where R,
mosaic, BSDA, and every other package this book needs are already
installed for you. You open a web browser, sign in, and start writing R
immediately. Nothing below requires you to have ever used R, Jupyter, or a
command line before.
Step 1 — Go to the JupyterHub URL.
Open https://
Step 2 — Sign in with your CSUB credentials. Use the same campus username and password you already use for email and MyCSUB. This is your existing CSUB account — there is no separate sign-up and nothing new to create. If your credentials don’t work here, they’re almost certainly the same account issue you’d hit signing in to email or MyCSUB, so that’s the right place to get it fixed (campus IT / help desk).
Step 3 — Wait for your server to start, then look at the launcher. The first time you sign in during a session, the Hub spends a few seconds “starting your server” — a private workspace made just for you. Once it’s ready you land on the launcher: a screen of tiles, each one a way to start something new. This screen is standard JupyterLab (the software the Hub runs), so on any deployment you should see a Notebook section with a tile labeled R (its icon is the blue-and-grey R logo used everywhere R runs inside Jupyter), and usually an R console tile nearby too — the exact layout and theme can vary a little by deployment, but those two tiles are what you’re looking for. A notebook mixes writing and code in one document (Step 4 below and all of L03 are about this); a console is a bare, line-by-line place to type R with no document around it. As a beginner, start with a notebook: click the R tile under Notebook, and a new, mostly-empty notebook opens with one empty box waiting for you.
Step 4 — Type a line of R and run it. Click into that empty box (a cell) and type a line of R, for example:
2 + 2Press Shift+Enter — this runs the cell and moves you to the next one. The result appears directly underneath the cell, in the notebook itself:
[1] 4That’s it — you just ran R in your browser with nothing installed. Ctrl+Enter runs a cell without moving to the next one, if you want to rerun something in place. L03 covers notebooks — cells, order of execution, saving — in full depth.
Step 5 — Load this book’s packages: nothing to install, just library().
Unlike a fresh local install (Option A), the JupyterHub already has mosaic
and BSDA installed system-wide for every CSUB user. You never run
install.packages() here — just load them, in a new cell, every time you
start a fresh notebook:
library(mosaic)
library(BSDA)Running that produces a block of messages about “masked” functions — that is
normal, expected output, not an error (L05 explains exactly what
it means and shows the full message). As long as you don’t see red Error
text, both packages are ready to use.
5Which one should you use?¶
There is no wrong choice — many people switch between them:
Use the JupyterHub as a beginner, for CSUB labs (they are built for it), for a quick check on any device, or if your own computer can’t install software. It is the fastest path from “never used R” to “R is running” — start here if you’re unsure.
Use local RStudio for homework, projects, and any time you want R installed permanently and working offline.
Either way, the R code you write is identical — mosaic and BSDA behave
the same whether you’re in RStudio or a JupyterHub notebook. L03
walks through the actual working environment (panes, cells, projects) for
both.
6Summary¶
R (the engine) and RStudio (the interface) are two separate installs; you need both for a local setup.
install.packages(c("mosaic", "BSDA")), run once in the RStudio console, adds this book’s entire toolkit locally.The CSUB JupyterHub (
csub.jupyter.cal-icor.org) needs no installation: sign in with your CSUB campus credentials, open a new notebook under the R tile in the launcher, type code in a cell, and press Shift+Enter to run it.mosaicandBSDAare already installed on the Hub — justlibrary(mosaic)andlibrary(BSDA), noinstall.packages()needed.Your Hub notebooks live on CSUB’s server; download a copy (file browser → right-click → Download) for anything you want to keep permanently.
For a beginner starting from zero, the JupyterHub is the recommended starting point; local RStudio is the alternative once you want R installed permanently or need to work offline.