1Objectives¶
By the end of this lesson you will be able to:
Explain, in your own words, what R is.
Explain the difference between R, RStudio, and JupyterHub.
Explain why MATH 1209 shows you R at all, given that you can pass the course with a calculator.
Type one line of R and read the answer it prints back.
2The idea, in plain words¶
R is a free program that does math and works with data. That’s it — that’s the whole idea. You type an instruction (“add these numbers,” “find the average,” “draw a graph of this”), press a key, and R does it and shows you the result. People also call R a programming language, which sounds intimidating, but a language is just a set of words and grammar rules for telling R what to do — and you’ll only need a small vocabulary for this course.
R was built by and for statisticians, so unlike a general-purpose programming language, it already knows how to compute a mean, run a hypothesis test, or draw a histogram — those aren’t things you’ll build from scratch, they’re single commands you’ll learn to call.
3R, RStudio, and JupyterHub — three names, one engine¶
This trips up almost everyone at first, so let’s separate the three words you’ll see this semester.
| Term | What it actually is | Analogy |
|---|---|---|
| R | The engine that does the calculations. You never see R by itself — it runs invisibly underneath the other two. | The engine under the hood of a car |
| RStudio | A free program that gives R a friendly window: a place to write code, see results, view graphs, and browse your files, all at once. You install this on your own computer. | The car’s dashboard, seats, and steering wheel |
| CSUB JupyterHub | A website your instructor gives you a link to. It also gives R a friendly window — a notebook in your browser — except R is running on a CSUB server, not your laptop, so there is nothing to install. | Renting the same car instead of buying one |
Whichever one you use, the R underneath is identical — the same commands, the same answers. Lesson 2 walks you through setting up either option, and Lesson 3 shows you what actually running code looks like in each.
4Why does a calculator-first course even mention R?¶
Look back at how this course works: every method is taught idea → formula → calculator steps → “see it in R.” R is there for three honest reasons:
To double-check your work. If your calculator says one thing and R says the same thing, you can trust the answer.
To see the “why” faster. Some ideas (like what happens if you repeat an experiment 1,000 times) are much easier to see than to compute by hand — R can run something 1,000 times in under a second.
To give you a small head start, at zero cost, on a tool that shows up in business analytics, health records, government data, psychology research, and more — without turning this GE course into a coding class.
5Your first line of R¶
Whatever tool you end up using (Lesson 2), you’ll always be looking at the same
basic idea: you type something, and R answers back on the next line, starting with
[1]. Here’s a real example — this is the exact code that was run, and the exact
answer R printed:
2 + 2[1] 4The [1] just means “this is the first value in the answer” — you’ll mostly ignore
it for now. A few more, so the pattern sinks in:
10 * 4 - 3[1] 37mean(c(90, 85, 95))[1] 90That last one introduces two things you’ll meet properly in Lesson 4:
c(90, 85, 95) bundles three numbers into a list R can work with (a vector),
and mean(...) is a function — a built-in verb that does something to whatever
you put inside its parentheses. Here it found the average of three exam scores.
R can also work with text, not just numbers:
"Hello, R!"[1] "Hello, R!"Notice the quotation marks stayed in the answer — that’s R’s way of showing you “this is text, not a number.” You’ll see this distinction again in Lesson 4.
6A map of the rest of this book¶
Lessons 2–3 get R actually running in front of you, in whichever tool you choose.
Lessons 4–6 teach the small R vocabulary you need: storing values, building lists of numbers, calling functions, turning on this course’s toolkit, and loading data.
Lessons 7–9 connect R back to the statistics you’re learning: summarizing data, the Normal model, and confidence intervals/tests.
Lessons 10–12 are polish: better graphs, good habits, and a troubleshooting table for when something doesn’t run.
7Summary¶
R is free software that computes and analyzes data; RStudio and JupyterHub are two different friendly windows onto the same R engine.
This course is calculator-first — R is a bonus tool, never a requirement to pass.
A line of R code produces output that appears right below it, usually starting with
[1].
8Check your understanding¶
In your own words, what is the difference between R and RStudio?
Why does this book say you can succeed in MATH 1209 without ever opening R?
What do you predict
5 * 5 - 5will print? (You’ll be able to check this for real once you finish Lesson 2.)