Load Libraries

# Load any R Packages you may need

library(mosaic)

Exercise 1

The state of Arizona records the number of automobile deaths two years ago in each of the state’s 14 counties:

(a)

Using R, enter these data into a variable called autodths.

autodths <- c (30, 15, 183, 9, 7, 39, 28, 30, 76, 13, 21, 18, 323, 3)

print(autodths)
##  [1]  30  15 183   9   7  39  28  30  76  13  21  18 323   3

(b)

What is the mean number of deaths per county?

auto.mean <- mean(autodths)

print(auto.mean)
## [1] 56.78571

The average number of deaths per county is 56.79.

(c)

What is the median number of deaths per county?

auto.med <- median(autodths)

print(auto.med)
## [1] 24.5

The median number of deaths per county is 24.5.


Exercise 2

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:

(a)

Using R, enter these data into a variable called polpref.

polpref <- c("D", "I", "I", "D", "I", "D", "I", "I", "I", "D", "I", "R", "D", "D" )

print(polpref)
##  [1] "D" "I" "I" "D" "I" "D" "I" "I" "I" "D" "I" "R" "D" "D"

(b)

Use the tally() function to determine the most popular choice of political preference.

pop.pol <- tally(polpref)

print(pop.pol)
## X
## D I R 
## 6 7 1

The most popular choice of political preference is Independent


Exercise 3

(a)

Create a Canva Presentation with two slides:

  • Slide 1: Create a data visualization for the data in Exercise 1
  • Slide 2: Create a data visualization for the data in Exercise 2

(b)

Embed your Canva Presentation Here:

MeaeraNystrom-Homework1 by MNys

(c)

Trouble embedding? No worries! Provide your Canva link here as a back-up

URL Link to Canva Site: MeaeraNystrom-Homework 1


All done!

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.