


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



The (>) symbol indicates something that you will type in. A bullet (•) indicates what the R program should output (and other comments).
Type (in the R Console window): scores <- c(42, 8, 59) Press RETURN or ENTER on your computer.
Type: scores
Type: scores[3]
Type: sum(scores)
Type: ?c
Type: seq(0, 100)
Type: seq(0, 100, by=5)
The following is a list of the ages of the U.S. presidents when they became president. (The ages are in years, rounded down.)
(President Obama was 47, but he is not included in the table presented in the class notes. The notes were written before 2009.)
Type: ages = scan( )
Copy and paste the 43 numbers in the PRESIDENTS’ AGES DATA SET above.
Press RETURN or ENTER on your computer.
Press RETURN or ENTER again, since we are not entering in any more values.
Type: ages[16]
Type: barplot(ages)
Type: hist(ages)
Type: hist(ages, breaks=boundaries)
RELATIVE FREQUENCY HISTOGRAMS and LABELS
Type: hist(ages, prob=TRUE)
Type: hist(ages, breaks=boundaries, prob=T, main="Relative frequency histogram", ylab="Relative frequencies")