source("R/install_packages.R")Getting started
What you need
Install:
- R — the language and environment that performs the statistical computing;
- RStudio Desktop — the integrated development environment (IDE) used to write, run, inspect, and organize R work;
- Quarto — optional for students; needed only if you want to render the complete website or reproducible reports.
You do not need previous programming experience.
R and RStudio are not the same thing
R
- programming language;
- statistical computing environment;
- runs calculations and models;
- creates objects and graphics;
- extended through packages.
RStudio
- interface/IDE for working with R;
- script editor;
- Console;
- Environment;
- Files, Plots, Packages, Help.
A useful analogy is: R is the engine; RStudio is the dashboard and workspace.
Download the course
- Open the GitHub repository.
- Choose Code → Download ZIP.
- Extract the ZIP.
- Double-click
r-for-management-research.Rproj.
Opening the .Rproj file gives the analysis a stable project context, so paths such as data/employee_survey.csv work on different computers.
Install the packages
Open R/install_packages.R and click Source, or run:
Check the setup:
source("R/check_setup.R")Know the four panes
| Pane | Use |
|---|---|
| Source | write and save scripts |
| Console | execute commands immediately |
| Environment | inspect objects currently stored in memory |
| Output | Files, Plots, Packages, Help, Viewer |
Script vs Console: experiment in the Console; keep meaningful analysis in a script. A script records what you did and makes the work reproducible.
Your first five minutes
2 + 2
course_name <- "Research & Evidence: Data, Methods & Design"
number_of_students <- 30
course_name
number_of_students<- assigns a value to an object. Read it as “gets”.
After running those lines, look at the Environment pane. You should see the objects appear.
Run code
Place the cursor on a line and use:
- Windows/Linux:
Ctrl + Enter - macOS:
Cmd + Enter
Run a script from top to bottom when later steps depend on objects created earlier.
File paths
Use project-relative paths:
employees <- readr::read_csv("data/employee_survey.csv")Avoid machine-specific paths such as:
"C:/Users/YourName/Desktop/course/data.csv"A simple debugging routine
When code fails:
- read the first error message;
- check spelling and capitalization;
- check commas, brackets, and quotation marks;
- confirm the package was loaded;
- confirm the object and variable names exist;
- rerun the earlier lines that create required objects.
Errors are normal. Treat them as information about the state of your analysis, not as a score of your programming ability.