Theory
Two downloads, one common mistake
Lab day. Half the class downloads "RStudio" first because the name sounds complete, double-clicks... and meets an error: no R installation found.
Because RStudio is not R. R is the engine: the language that computes. RStudio is the dashboard bolted around it: editor, plots, help, all in one window.
Dashboards are useless without engines. Install in the right order and the whole thing takes ten minutes.
Theory
Engine first, then the car around it
R alone is a working engine on a stand: you CAN run it bare (a plain white console: type commands, get answers).
RStudio is the car built around that engine: seats (editor), speedometer (environment pane), rear-view mirror (history), music system (plots). Comfortable, but it will not move an inch without the engine bolted in first.
Order of installation = order of dependency: engine, then car.
Follow along
The installation, in order
- Install R from CRAN: cran.r-project.org Choose your OS: Windows: 'base' installer (.exe); Mac: the .pkg; Linux: your package manager. Accept the defaults.
- Install RStudio Desktop (free) from posit.co The company behind RStudio renamed itself Posit: same free IDE. RStudio auto-detects the R you installed in step 1.
- Verify: open RStudio The console (bottom-left) prints the R version banner. If it complains about missing R, step 1 was skipped.
- Type 2 + 2 at the > prompt and press Enter R answers [1] 4. The [1] is R numbering the first element of the answer: normal, not an error.
- Set the working directory for this course Session menu > Set Working Directory > Choose Directory: point it at the folder holding survey.csv. Check with getwd().
Theory
The four panes of RStudio
One window, four quadrants, each with a job:
- Console (bottom-left): type a command, get the answer: the interactive heart.
- Source (top-left): write .R script files: saved, repeatable; Ctrl+Enter sends the current line to the console.
- Environment (top-right): every variable currently in memory, live.
- Files / Plots / Packages / Help (bottom-right): your charts appear under Plots;
?meanopens documentation under Help.
Console = scratchpad (gone when you quit); Script = record (your actual work). Serious analysis lives in scripts.
Quiz
A student installs ONLY RStudio on a fresh laptop and opens it. What happens, and why?
- An error about a missing R installation: RStudio is only the IDE and needs the R engine installed first
- It works fine: RStudio contains R inside it
- It works, but only for small datasets
- The laptop needs Python installed instead
Show the answer
An error about a missing R installation: RStudio is only the IDE and needs the R engine installed first
RStudio ships no engine: it is the dashboard that drives whatever R it finds on the machine, and finds none. The fix is the correct order: R from CRAN first, RStudio from posit.co second. This engine/dashboard distinction, and which website provides which piece, is exactly what the exam's "explain the installation of R and RStudio" question wants.
Think first
Diagnose the missing file
R and RStudio are installed perfectly. The student types read.csv("survey.csv") and gets: cannot open file 'survey.csv': No such file or directory. The file definitely exists, in the Downloads folder. Before tapping: what is wrong, and name TWO fixes.
Show the answer
R looks for files in its working directory, which is not Downloads. Fixes:
1. Move the pointer: Session > Set Working Directory > Choose Directory (or setwd("C:/Users/you/Downloads")), then the bare filename works.
2. Give the full path: read.csv("C:/Users/you/Downloads/survey.csv").
Check where R is looking with getwd(). This is R's version of BCA303's connect-typo trap: the number one beginner error, and it is about location, not code.
Watch out
Small habits that prevent lost work
Console vs script: commands typed in the console vanish with the session: anything worth keeping goes in a .R file (top-left) and runs with Ctrl+Enter.
The [1] prefix in output is R labelling element positions, not an error code.
Case sensitivity starts now: Mean(x) fails; mean(x) works: R never forgives capitals.
Theory
Your workspace is ready
Engine installed, dashboard fitted, working directory aimed at the survey data. Next lesson the actual language begins: the <- assignment arrow, vectors built with c(), and R's data types: the grammar every later command uses. Keep RStudio open while studying these lessons: every code block you see is meant to be typed and run.
Summary
Key takeaways
- R (the engine) installs from CRAN; RStudio Desktop (the IDE) from posit.co: in that order.
- RStudio without R = error: it ships no engine.
- Four panes: console (interact), source (scripts, Ctrl+Enter), environment (variables), files/plots/help.
- Scripts persist, console history does not: real work lives in .R files.
- Working directory (getwd/setwd or the Session menu) is where read.csv looks: the classic file-not-found cause.
- R is case-sensitive; [1] in output is element numbering.
- Memory hook: engine first, then the car around it.