library(tidyverse)
pew <- read_csv("January 3-10, 2018 - Core Trends Survey/January 3-10, 2018 - Core Trends Survey - CSV.csv")
Parsed with column specification:
cols(
.default = col_double(),
usr = [31mcol_character()[39m,
`pial11ao@` = [31mcol_character()[39m
)
See spec(...) for full column specifications.
glimpse(pew)
Observations: 2,002
Variables: 70
$ respid [3m[90m<dbl>[39m[23m 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14…
$ sample [3m[90m<dbl>[39m[23m 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
$ comp [3m[90m<dbl>[39m[23m 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
$ int_date [3m[90m<dbl>[39m[23m 180103, 180103, 180103, 180103, 180103, 1…
$ lang [3m[90m<dbl>[39m[23m 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
$ cregion [3m[90m<dbl>[39m[23m 1, 3, 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, 1, 3,…
$ state [3m[90m<dbl>[39m[23m 42, 45, 34, 24, 33, 37, 12, 34, 51, 54, 5…
$ density [3m[90m<dbl>[39m[23m 5, 2, 5, 4, 2, 3, 5, 5, 1, 2, 2, 5, 4, 1,…
$ usr [3m[90m<chr>[39m[23m "U", "S", "S", "S", "R", "U", "U", "S", "…
$ qs1 [3m[90m<dbl>[39m[23m NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
$ sex [3m[90m<dbl>[39m[23m 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2,…
$ eminuse [3m[90m<dbl>[39m[23m 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1,…
$ intmob [3m[90m<dbl>[39m[23m 1, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1,…
$ intfreq [3m[90m<dbl>[39m[23m 1, NA, 3, 4, 2, 2, 2, 2, NA, 2, 2, 2, NA,…
$ home4nw [3m[90m<dbl>[39m[23m 1, NA, 1, 1, 1, 1, 1, 1, NA, 1, 1, 1, NA,…
$ bbhome1 [3m[90m<dbl>[39m[23m 2, NA, 2, 2, 2, 2, 2, 2, NA, 2, 2, 2, NA,…
$ bbhome2 [3m[90m<dbl>[39m[23m NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
$ device1a [3m[90m<dbl>[39m[23m 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1,…
$ smart2 [3m[90m<dbl>[39m[23m 1, 2, 1, 1, 1, 1, 1, 1, NA, 1, 1, 1, NA, …
$ snsint2 [3m[90m<dbl>[39m[23m 1, 2, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1,…
$ device1b [3m[90m<dbl>[39m[23m 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 1, 2, 2,…
$ device1c [3m[90m<dbl>[39m[23m 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1,…
$ device1d [3m[90m<dbl>[39m[23m 1, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2,…
$ web1a [3m[90m<dbl>[39m[23m 2, 2, 2, 2, 2, 1, 2, 2, NA, 2, 1, 2, NA, …
$ web1b [3m[90m<dbl>[39m[23m 1, 2, 2, 2, 2, 2, 2, 2, NA, 2, 1, 2, NA, …
$ web1c [3m[90m<dbl>[39m[23m 1, 2, 2, 1, 1, 1, 1, 1, NA, 1, 1, 1, NA, …
$ web1d [3m[90m<dbl>[39m[23m 1, 2, 2, 2, 2, 2, 2, 2, NA, 2, 2, 2, NA, …
$ web1e [3m[90m<dbl>[39m[23m 1, 2, 2, 2, 1, 1, 1, 1, NA, 1, 1, 1, NA, …
$ web1f [3m[90m<dbl>[39m[23m 1, 2, 2, 2, 2, 2, 2, 2, NA, 2, 2, 2, NA, …
$ web1g [3m[90m<dbl>[39m[23m 2, 2, 2, 2, 1, 1, 1, 1, NA, 2, 2, 2, NA, …
$ web1h [3m[90m<dbl>[39m[23m 2, 2, 2, 2, 1, 1, 1, 1, NA, 2, 2, 2, NA, …
$ sns2a [3m[90m<dbl>[39m[23m NA, NA, NA, NA, NA, 2, NA, NA, NA, NA, 1,…
$ sns2b [3m[90m<dbl>[39m[23m 1, NA, NA, NA, NA, NA, NA, NA, NA, NA, 4,…
$ sns2c [3m[90m<dbl>[39m[23m 1, NA, NA, 3, 3, 1, 3, 2, NA, 2, 3, 5, NA…
$ sns2d [3m[90m<dbl>[39m[23m 3, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ sns2e [3m[90m<dbl>[39m[23m 3, NA, NA, NA, 2, 3, 5, 4, NA, 4, 4, 3, N…
$ pial5a [3m[90m<dbl>[39m[23m 2, 2, 1, 2, 1, 3, 3, 2, 6, 1, 1, 2, 1, 1,…
$ pial5b [3m[90m<dbl>[39m[23m 1, 3, 2, 3, 2, 5, 3, 2, NA, 2, 4, 1, NA, …
$ pial5c [3m[90m<dbl>[39m[23m 2, NA, 1, 3, 1, 1, 3, 2, NA, 2, 1, 1, NA,…
$ pial5d [3m[90m<dbl>[39m[23m 3, NA, NA, 3, 3, 1, 4, 3, NA, 3, NA, 4, N…
$ pial11 [3m[90m<dbl>[39m[23m 1, 8, 1, 2, 1, 3, 8, 1, 8, 1, 1, 1, 8, 1,…
$ pial11a [3m[90m<dbl>[39m[23m 1, NA, 1, 1, 1, NA, NA, 1, NA, 1, 1, 1, N…
$ `pial11ao@` [3m[90m<chr>[39m[23m "information has become available more fr…
$ pial11_igbm [3m[90m<dbl>[39m[23m 1, 9, 2, 5, 1, 9, 9, 1, 9, 1, 1, 1, 9, 1,…
$ pial12 [3m[90m<dbl>[39m[23m 1, NA, 1, 1, 1, 1, 1, 1, NA, 1, 1, 1, NA,…
$ books1 [3m[90m<dbl>[39m[23m 1, 5, 0, 2, 6, 18, 3, 2, 3, 97, 5, 8, 6, …
$ books2a [3m[90m<dbl>[39m[23m 1, 1, NA, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1…
$ books2b [3m[90m<dbl>[39m[23m 2, 2, NA, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2…
$ books2c [3m[90m<dbl>[39m[23m 2, 2, NA, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1…
$ age [3m[90m<dbl>[39m[23m 33, 76, 99, 60, 55, 58, 99, 72, 58, 68, 6…
$ marital [3m[90m<dbl>[39m[23m 2, 1, 5, 2, 1, 1, 1, 1, 6, 1, 1, 1, 1, 1,…
$ educ2 [3m[90m<dbl>[39m[23m 3, 98, 5, 5, 4, 7, 5, 6, 1, 6, 7, 6, 7, 6…
$ emplnw [3m[90m<dbl>[39m[23m 1, 3, 5, 8, 1, 1, 5, 4, 4, 3, 3, 2, 3, 3,…
$ hisp [3m[90m<dbl>[39m[23m 2, 2, 2, 2, 2, 2, 9, 2, 2, 2, 2, 2, 2, 2,…
$ racem1 [3m[90m<dbl>[39m[23m 1, 1, 1, 1, 1, 1, 9, 1, 2, 1, 1, 1, 3, 1,…
$ racem2 [3m[90m<dbl>[39m[23m NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
$ racem3 [3m[90m<dbl>[39m[23m NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
$ racem4 [3m[90m<dbl>[39m[23m NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
$ racecmb [3m[90m<dbl>[39m[23m 1, 1, 1, 1, 1, 1, 9, 1, 2, 1, 1, 1, 3, 1,…
$ birth_hisp [3m[90m<dbl>[39m[23m NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
$ inc [3m[90m<dbl>[39m[23m 6, 4, 4, 2, 7, 7, 9, 6, 1, 2, 2, 6, 4, 5,…
$ party [3m[90m<dbl>[39m[23m 2, 3, 1, 2, 1, 3, 2, 3, 1, 4, 1, 3, 2, 1,…
$ partyln [3m[90m<dbl>[39m[23m NA, 8, NA, NA, NA, 2, NA, 2, NA, 8, NA, 1…
$ hh1 [3m[90m<dbl>[39m[23m 5, 2, 1, 2, 3, 2, 2, 2, 1, 2, 5, 2, 2, 2,…
$ hh3 [3m[90m<dbl>[39m[23m 4, 2, NA, 2, 3, 2, 2, 2, NA, 2, 4, 2, 2, …
$ ql1 [3m[90m<dbl>[39m[23m 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1,…
$ ql1a [3m[90m<dbl>[39m[23m NA, 2, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ qc1 [3m[90m<dbl>[39m[23m NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
$ weight [3m[90m<dbl>[39m[23m 1.7463586, 1.6597644, 0.4908044, 0.947965…
$ cellweight [3m[90m<dbl>[39m[23m NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
For this assignment, I chose to use Instagram (web1b).
pew <- pew %>%
mutate(web1b=as.factor(web1b))
pew <- pew %>%
mutate(web1b = fct_recode(web1b, "Yes" = "1" , "No" = "2" ,"NULL"= "8", "NULL" = "9"))
pew%>%
count(web1b)
NA
NA
NA
From the dataset survey, 627 people responded that they use Instagram, and 1,323 people don’t use it. Three people reported that they either don’t know if they use it, or refused to give an answer. Fourty-nine people did not answer the question.
pew <- pew %>%
mutate(educ2=as.factor(educ2))
pew<-pew %>%
mutate(educ2=fct_recode(educ2,"Education Level" = "educ2", "Less than HS" = "1" , "Some HS" = "2" ,"HS Graduate" = "3", "Some College" = "4", "Associate Degree" = "5", "College Graduate" = "6", "Some grad school" = "7", "Grad degree" = "8", "NULL" = "98", "NULL" = "99"))
Unknown levels in `f`: educ2, 1, 2, 3, 4, 5, 6, 7, 8
pew%>%
count(educ2)
NA
From this dataset, the highest number of responders are either college or high school graduates.
pew %>%
count(web1b) %>%
drop_na()
NA
Out of those who use Instagram, most are college graduates (6) and the next largest users are high school graduates. Interestingly, those who don’t use Instagram are highest at the same population: high school and college graduates.
pew %>%
count(educ2) %>%
drop_na()
Here is the counts for educ 2.
pew %>%
count(web1b, educ2) %>%
drop_na()
pew %>%
drop_na(web1b,educ2) %>%
ggplot(aes(x=educ2, fill = web1b))+
geom_bar(position="dodge")+
scale_fill_viridis_d()+
coord_flip()+
labs(title="Instagram Users and Education Level")
This data shows the same results as the previous table in question 4, but presents it visually. Education level is on the y axis, with reporting on Instagram usage on the x axis.
pew <- pew %>%
mutate(education_condensed= fct_collapse(educ2, HS_grad_or_less = c("Less than HS", "Some HS", "HS Graduate"), Some_college_or_more = c("Some College", "Associate Degree", "College Graduate", "Some grad school", "Grad degree")))
pew %>%
count(education_condensed)
Here is the data for education levels condensed down into two groups: those that only were educated up through high school, and those who have some college education all the way through graduate degree holders. There are clearly more people with at least some college education, and a very small portion of people who refused to list their education level, or left the question blank.
pew%>%
drop_na(web1b, educ2)
ggplot(pew, aes(x=education_condensed, fill = web1b))+
geom_bar(position="dodge")+
scale_fill_viridis_d()+
labs(title="Instagram Users and Condensed Education Levels")
Here is a graph depicting the condensed education data, with education level on the x-axis and number of participants on the y-axis. According to the data, most people with at least some college education don’t use Instagram. However, the trend is similar in the group of people who only got through high school. Both groups have a larger number of participants who don’t use Instagram, as opposed to those who do.