Use R/RStudio to work on the following problems from the textbook.
- Exercises 2–1, Question 13 page 52.
- Exercises 2–1, Question 14 page 52.
Note:
- Before working on the project, make sure you have reviewed 2.1: Organizing data.
- Write your code using R Script \((Ctrl + Shift + N)\) and make sure you save your script.
- Once you are done, test your code to make sure it is running and you are getting the desired results.
- Copy and paste into a word document the relevant portions of your results shown in the Console.
- Save your word document and then upload on Moodle.
Solution to Project 2
# Question 13:
grade <- c("F","C","F","A","B","C","F","F","B",
"C","A","B","C","C","F","F","A","F",
"C","A","C","C","F","F","C","F","F",
"B","C","F","B","A","F","B","F","F",
"C","B","A","C","B","F","C","F","A",
"B","B","F","C","F")
freq <- table(grade)
freq
## grade
## A B C F
## 7 10 14 19
- The class with the most data values is Professional Football (F).
- The class which with the fewest data values is Auto Racing (A).
# Question 14:
trust <- c("M","M","M","A","H","M","S","M","H","M",
"S","M","M","M","M","A","M","M","A","M",
"M","M","H","M","M","M","H","M","H","M",
"A","M","M","M","H","M","M","M","M","M")
freq_trust <- table(trust)
freq_trust
## trust
## A H M S
## 4 6 28 2