Explanation 1
Download the CSV from STATLAB Data Resources.
Loading
Lesson 5 of 6
Download the maintained Canadian macroeconomic CSV, import it in RStudio, inspect it, and draw a first chart.
Real course data
Download canada_macro_monthly.csv from STATLAB Data Resources. If you downloaded the complete ZIP, extract it first. Open RStudio, run file.choose(), and select the CSV in the file-selection window.
Explanation 1
Download the CSV from STATLAB Data Resources.
Explanation 2
Extract the ZIP first if you downloaded the complete student pack.
Explanation 3
Use file.choose() so you do not need to type a fragile local path.
Resource
Download the real maintained CSV used in STATLAB lessons.
Download canada_macro_monthly.csvResource
Open the resource page for the data dictionary, source notes, starter script, guide, and complete student pack.
Open Data ResourcesCopyable code
macro <- read.csv(file.choose())Copyable code
View(macro)
head(macro)
str(macro)
summary(macro)Terminology
Opens a spreadsheet-style viewer.
Use it to scan rows and columns.
Displays the first six observations.
Use it to confirm the import looks sensible.
Identifies variables and data types.
Check whether date and numeric columns imported correctly.
Calculates basic summaries.
Review ranges and possible missing values.
Copyable code
Consult the dataset dictionary before selecting variables for analysis.
names(macro)Copyable code
This example uses the confirmed columns date and inflation_yoy_percent from canada_macro_monthly.csv.
macro$date <- as.Date(macro$date)
plot(macro$date, macro$inflation_yoy_percent,
type = "l",
main = "Canadian inflation over time",
xlab = "Date", ylab = "Year-over-year inflation (%)")Extract compressed files first
Do not run scripts or data files from inside a compressed ZIP preview. Extract the archive first.