pew <- read_csv("January 3-10, 2018 - Core Trends Survey/January 3-10, 2018 - Core Trends Survey - CSV.csv")
── Column specification ──────────────────────────────────────────────────────────────────
cols(
.default = col_double(),
usr = col_character(),
`pial11ao@` = col_character()
)
ℹ Use `spec()` for the full column specifications.
glimpse(pew)
Rows: 2,002
Columns: 70
$ respid <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 20, 21, 23, 24, 25, …
$ sample <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
$ comp <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
$ int_date <dbl> 180103, 180103, 180103, 180103, 180103, 180103, 180103, 180103, 180…
$ lang <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
$ cregion <dbl> 1, 3, 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 3, 2, 1, 1, 2, 1, 2, 1…
$ state <dbl> 42, 45, 34, 24, 33, 37, 12, 34, 51, 54, 51, 12, 42, 37, 51, 21, 39,…
$ density <dbl> 5, 2, 5, 4, 2, 3, 5, 5, 1, 2, 2, 5, 4, 1, 2, 2, 2, 3, 1, 5, 4, 5, 1…
$ usr <chr> "U", "S", "S", "S", "R", "U", "U", "S", "R", "R", "S", "U", "S", "R…
$ qs1 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ sex <dbl> 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2…
$ eminuse <dbl> 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1…
$ intmob <dbl> 1, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 1, 2, 1, 1…
$ intfreq <dbl> 1, NA, 3, 4, 2, 2, 2, 2, NA, 2, 2, 2, NA, 3, 2, 2, NA, 4, NA, 3, 3,…
$ home4nw <dbl> 1, NA, 1, 1, 1, 1, 1, 1, NA, 1, 1, 1, NA, 1, 1, 1, NA, 2, NA, 1, 1,…
$ bbhome1 <dbl> 2, NA, 2, 2, 2, 2, 2, 2, NA, 2, 2, 2, NA, 2, 2, 2, NA, NA, NA, 2, 2…
$ bbhome2 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ device1a <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 2, 2, 1, 2…
$ smart2 <dbl> 1, 2, 1, 1, 1, 1, 1, 1, NA, 1, 1, 1, NA, 1, 1, 1, 2, 1, NA, NA, NA,…
$ snsint2 <dbl> 1, 2, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2…
$ device1b <dbl> 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1…
$ device1c <dbl> 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 1…
$ device1d <dbl> 1, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 9, 2, 2, 1, 2, 1, 2, 2, 2…
$ web1a <dbl> 2, 2, 2, 2, 2, 1, 2, 2, NA, 2, 1, 2, NA, 1, 2, 2, 2, 2, NA, 2, 2, 2…
$ web1b <dbl> 1, 2, 2, 2, 2, 2, 2, 2, NA, 2, 1, 2, NA, 2, 2, 2, 2, 2, NA, 2, 2, 2…
$ web1c <dbl> 1, 2, 2, 1, 1, 1, 1, 1, NA, 1, 1, 1, NA, 1, 1, 2, 2, 1, NA, 2, 2, 2…
$ web1d <dbl> 1, 2, 2, 2, 2, 2, 2, 2, NA, 2, 2, 2, NA, 2, 2, 2, 2, 1, NA, 2, 2, 2…
$ web1e <dbl> 1, 2, 2, 2, 1, 1, 1, 1, NA, 1, 1, 1, NA, 1, 2, 2, 2, 1, NA, 1, 2, 1…
$ web1f <dbl> 1, 2, 2, 2, 2, 2, 2, 2, NA, 2, 2, 2, NA, 1, 2, 2, 2, 2, NA, 2, 2, 2…
$ web1g <dbl> 2, 2, 2, 2, 1, 1, 1, 1, NA, 2, 2, 2, NA, 1, 1, 2, 2, 8, NA, 1, 2, 1…
$ web1h <dbl> 2, 2, 2, 2, 1, 1, 1, 1, NA, 2, 2, 2, NA, 2, 2, 2, 2, 2, NA, 8, 2, 2…
$ sns2a <dbl> NA, NA, NA, NA, NA, 2, NA, NA, NA, NA, 1, NA, NA, 4, NA, NA, NA, NA…
$ sns2b <dbl> 1, NA, NA, NA, NA, NA, NA, NA, NA, NA, 4, NA, NA, NA, NA, NA, NA, N…
$ sns2c <dbl> 1, NA, NA, 3, 3, 1, 3, 2, NA, 2, 3, 5, NA, 1, 5, NA, NA, 5, NA, NA,…
$ sns2d <dbl> 3, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
$ sns2e <dbl> 3, NA, NA, NA, 2, 3, 5, 4, NA, 4, 4, 3, NA, 4, NA, NA, NA, 3, NA, 1…
$ pial5a <dbl> 2, 2, 1, 2, 1, 3, 3, 2, 6, 1, 1, 2, 1, 1, 3, 2, 1, 1, 1, 1, 1, 3, 1…
$ pial5b <dbl> 1, 3, 2, 3, 2, 5, 3, 2, NA, 2, 4, 1, NA, 3, 1, 1, 4, 1, NA, NA, NA,…
$ pial5c <dbl> 2, NA, 1, 3, 1, 1, 3, 2, NA, 2, 1, 1, NA, 1, 3, 1, NA, 3, NA, 4, 1,…
$ pial5d <dbl> 3, NA, NA, 3, 3, 1, 4, 3, NA, 3, NA, 4, NA, 3, 4, NA, NA, NA, NA, N…
$ pial11 <dbl> 1, 8, 1, 2, 1, 3, 8, 1, 8, 1, 1, 1, 8, 1, 2, 1, 2, 1, 2, 1, 1, 1, 3…
$ pial11a <dbl> 1, NA, 1, 1, 1, NA, NA, 1, NA, 1, 1, 1, NA, 1, 1, 1, 1, 1, 1, 1, 1,…
$ `pial11ao@` <chr> "information has become available more frequently and easier", NA, …
$ pial11_igbm <dbl> 1, 9, 2, 5, 1, 9, 9, 1, 9, 1, 1, 1, 9, 1, 8, 1, 7, 1, 8, 1, 1, 1, 9…
$ pial12 <dbl> 1, NA, 1, 1, 1, 1, 1, 1, NA, 1, 1, 1, NA, 1, 8, 1, NA, 1, NA, 1, 1,…
$ books1 <dbl> 1, 5, 0, 2, 6, 18, 3, 2, 3, 97, 5, 8, 6, 3, 98, 12, 0, 1, 0, 0, 0, …
$ books2a <dbl> 1, 1, NA, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, NA, 2, NA, NA, NA,…
$ books2b <dbl> 2, 2, NA, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, NA, 1, NA, NA, NA,…
$ books2c <dbl> 2, 2, NA, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, NA, 2, NA, NA, NA,…
$ age <dbl> 33, 76, 99, 60, 55, 58, 99, 72, 58, 68, 65, 63, 88, 64, 40, 50, 67,…
$ marital <dbl> 2, 1, 5, 2, 1, 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, 1, 3, 8, 1, 6, 4, 5, 1…
$ educ2 <dbl> 3, 98, 5, 5, 4, 7, 5, 6, 1, 6, 7, 6, 7, 6, 7, 4, 4, 3, 3, 3, 5, 3, …
$ emplnw <dbl> 1, 3, 5, 8, 1, 1, 5, 4, 4, 3, 3, 2, 3, 3, 4, 1, 3, 6, 3, 6, 6, 3, 3…
$ hisp <dbl> 2, 2, 2, 2, 2, 2, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 8, 2, 2, 2, 2, 2…
$ racem1 <dbl> 1, 1, 1, 1, 1, 1, 9, 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1…
$ racem2 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ racem3 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ racem4 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ racecmb <dbl> 1, 1, 1, 1, 1, 1, 9, 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1…
$ birth_hisp <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ inc <dbl> 6, 4, 4, 2, 7, 7, 9, 6, 1, 2, 2, 6, 4, 5, 99, 9, 3, 1, 3, 1, 2, 3, …
$ party <dbl> 2, 3, 1, 2, 1, 3, 2, 3, 1, 4, 1, 3, 2, 1, 1, 1, 3, 3, 4, 8, 3, 1, 3…
$ partyln <dbl> NA, 8, NA, NA, NA, 2, NA, 2, NA, 8, NA, 1, NA, NA, NA, NA, 8, 2, 1,…
$ hh1 <dbl> 5, 2, 1, 2, 3, 2, 2, 2, 1, 2, 5, 2, 2, 2, 9, 9, 1, 2, 2, 5, 4, 3, 3…
$ hh3 <dbl> 4, 2, NA, 2, 3, 2, 2, 2, NA, 2, 4, 2, 2, 2, 2, 2, NA, 2, 2, 3, 4, 3…
$ ql1 <dbl> 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2…
$ ql1a <dbl> NA, 2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 2, NA, NA, NA, NA, N…
$ qc1 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ weight <dbl> 1.7463586, 1.6597644, 0.4908044, 0.9479652, 0.9159586, 0.4850252, 0…
$ cellweight <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
This is showing that I chose web1d, which is snapchat.
pew <- pew %>%
mutate(snapchat = as.factor(web1d))
pew %>%
count(snapchat)
This shows if the people used snapchat or not. They could answer with yes, no, dont know, or refused to answer.
pew <- pew %>%
mutate(snapchat = fct_recode(snapchat, "Yes" = "1", "No" = "2", "Don't know" = "8", "Refused" = "9"))
pew %>%
count(snapchat)
This shows the people education level compared to how many times they used snapchat.
pew <- pew %>%
mutate(education = as.factor(educ2))
pew %>%
count(education)
These are all the possible levels of education.
pew <- pew %>%
mutate(education = fct_recode(education, "Less than HS" = "1", "Some HS" = "2", "HS graduate" = "3", "Some college" = "4", "Associate degree" = "5", "College degree" = "6", "Some grad school" = "7", "Grad degree" = "8", "Don't know" = "98", "Refused" = "99"))
pew %>%
count(education)
This table is showing both their education level along with if they used snapchat.
pew %>%
count(snapchat, education)
pew %>%
drop_na(education)%>%
count(snapchat, education)
NA
Here is my graph of both variables.
pew %>%
drop_na(education) %>%
ggplot(aes(x = education, fill = snapchat)) +
geom_bar()+
scale_fill_viridis_d()+
coord_flip()
labs(y = "Number of people",
x = "Education level",
title = "Snapchat Usage")
$y
[1] "Number of people"
$x
[1] "Education level"
$title
[1] "Snapchat Usage"
attr(,"class")
[1] "labels"
This catagorizes the level of education that the person has recieved.
pew <- pew %>%
mutate(education_simple = fct_collapse(education,
daily_or_less = c("Less than HS",
"Some HS",
"HS graduate"),
more_than_hs = c("Some college",
"Associate degree",
"College degree",
"Some grad school",
"Grad degree")))
pew %>%
count(education_simple)
Here is my simple graph combining all the factors.
pew %>%
drop_na(education_simple) %>%
ggplot(aes(x = education_simple, fill = snapchat)) +
geom_bar()+
scale_fill_viridis_d()+
coord_flip()
labs(y = "Number of people",
x = "Education level",
title = "Snapchat Usage")
$y
[1] "Number of people"
$x
[1] "Education level"
$title
[1] "Snapchat Usage"
attr(,"class")
[1] "labels"