In-Class Exercise 1
Shih Chien University
2026-08-03
Use R as a calculator. In your script, evaluate the following three expressions and show the results:
Write one sentence explaining why the first expression does not equal \(126\) (hint: operator precedence).
Create a numeric vector named scores containing the values 85, 92, 78, 61, 95, 88, 70. Then:
mean() and its standard deviation with sd().length() to confirm how many elements it contains.Write one sentence interpreting what the standard deviation tells you about how spread out these scores are around the mean.
Load the ggplot2 package with library(ggplot2) and make your first plot: a scatterplot of the mpg dataset with engine displacement (displ) on the x-axis and highway fuel economy (hwy) on the y-axis, using geom_point().
Run the code, look at the plot, and write one sentence describing the relationship you see between engine size and highway fuel economy.
Complete your answers in the official template from the Problem sets page (author = your student ID only; keep the UUID chunk). Knit to PDF, name it ex1-[StudentID].pdf, and upload it to the course pCloud folder before midnight of the following week.
ggplot2: Elegant Graphics for Data Analysis