# Load any R Packages you may need
The state of Arizona records the number of automobile deaths two years ago in each of the state’s 14 counties:
Using R, enter these data into a variable called
autodths.
# Type your code here
autodths <- c(30, 15, 183, 9, 7, 39, 28, 30, 76, 13, 21, 18, 323, 3)
autodths
## [1] 30 15 183 9 7 39 28 30 76 13 21 18 323 3
length(autodths)
## [1] 14
What is the mean number of deaths per county?
# Type your code here
mean(autodths)
## [1] 56.78571
What is the median number of deaths per county? median(autodths)
# Type your code here
In a survey of students several years ago, one question asked for each student’s political preference (Democrat (D), Independent (I), or Republican (R)). Here are the 14 responses:
Using R, enter these data into a variable called
polpref.
# Type your code here
polpref <- c("D", "I", "I", "D", "I", "D", "I", "I", "I", "D", "I", "R", "D", "D")
polpref
## [1] "D" "I" "I" "D" "I" "D" "I" "I" "I" "D" "I" "R" "D" "D"
Use the tally() function to determine the most popular
choice of political preference.
# Type your code here
summary(factor(polpref))
## D I R
## 6 7 1
#was having issues with the mosaic package install, i know instructions said to use tally, for the sake of completing the assignment, i used summary, sorry
The most popular choice of political preference is TYPE YOUR ANSWER HERE #Indendent * * *
Create a Canva Presentation with two slides:
Embed your Canva Presentation Here: INSERT IFRAME EMBED CODE.
DON’T FORGET to add in data-external="1" at the end of your
<iframe> or else R-Markdown will not display
properly.
Knit the completed R Markdown file as a HTML document (click the “Knit” button at the top of the script editor window) and upload it to the submission portal on Canvas.