The goal of this lab is give you practice with reading data, manipulating data, creating variables, and computing statistics from the data.

Throughout the lab, there are questions that you will need to answer. Please submit your answers to the quiz on Canvas. Make sure to follow the directions to receive credit.

While you will not need to submit any files for this lab. It is recommended that you use an R Script to answer the questions. As with HW 1, part of your work in this lab will be used for HW 2.

You will need the following files for this lab: ca_pop.csv, ca_edu.xlsx, ca_med_inc.sav.

Question 1

Part A

The file ca_pop.csv contains the population estimates for each county in CA. Read the data into R and identify the name of the variable that contains the population size in the data frame.

Part B

The file ca_edu.xlsx contains the estimates of the number of individuals with a Bachelor’s a degree for each county in CA. The estimates are stratified by age group, i.e. each variable represents a different age group. Read the data into R and identify the number of individuals aged 18-24 who have a Bachelor’s degree in Riverside County.

Part C

The file ca_med_inc.sav contains the median income estimates for each county in California. Read the data into R and find the mean median income in CA.

Question 2

Merge all 3 data frames into 1 data frame. How many variables (columns) does the final merged data frame have?

Question 3

Southern California can be thought of as the composition of the following counties: San Luis Obispo, Kern, San Bernardino, Santa Barbara, Ventura, Los Angeles, Orange, Riverside, San Diego, and Imperial County. Create a variable indicating whether the county belongs to Southern California or not. The following vector may be useful:

socal <- c("San Luis Obispo County, California", "Kern County, California",
           "San Bernardino County, California", "Santa Barbara County, California",
           "Ventura County, California","Los Angeles County, California",
           "Orange County, California", "Riverside County, California",
           "San Diego County, California", "Imperial County, California")

Question 4

What is the population size for Southern California?

Question 5

How many individuals aged 35-44 have a Bachelor’s Degree in Southern California?

Question 6

What is the average median income in Southern California?