mnoetel / READI-SCRUB

For READI SCRUB project cleaning code and dashboard
Creative Commons Zero v1.0 Universal
1 stars 1 forks source link

Check that info_need_w2_ checkboxes are numbered 1-14 #21

Open aksaeri opened 4 years ago

aksaeri commented 4 years ago

As with W1, I have manually renumbered the info_need_w2 checkboxes that appear in:

to be numbered 1-14. This means we should be able to delete the following code

d$info_need_w2_government_tv <- grepl("Government-funded television channels", d$info_need_w2)
attr(d$info_need_w2_government_tv, "label") <- "Government-funded television channels"

d$info_need_w2_government_radio <- grepl("Government-funded radio stations", d$info_need_w2)
attr(d$info_need_w2_government_radio, "label") <- "Government-funded radio channels"

d$info_need_w2_commercial_radio <- grepl("Commercial radio stations", d$info_need_w2)
attr(d$info_need_w2_commercial_radio, "label") <- "Commercial radio stations"

d$info_need_w2_commercial_tv <- grepl("Commercial television stations", d$info_need_w2)
attr(d$info_need_w2_commercial_tv, "label") <- "Commercial television stations"

d$info_need_w2_commercial_online <- grepl("Commercial online news", d$info_need_w2)
attr(d$info_need_w2_commercial_online, "label") <- "Commercial online news"

d$info_need_w2_newspapers <- grepl("Daily or weekly newspapers", d$info_need_w2)
attr(d$info_need_w2_newspapers, "label") <- "Daily or weekly newspapers"

d$info_need_w2_family_friends <- grepl("Family and friends", d$info_need_w2)
attr(d$info_need_w2_family_friends, "label") <- "Family and friends"

d$info_need_w2_coworkers <- grepl("Co-workers", d$info_need_w2)
attr(d$info_need_w2_coworkers, "label") <- "Co-workers"

d$info_need_w2_healthcare <- grepl("Consultation with health care workers", d$info_need_w2)
attr(d$info_need_w2_healthcare, "label") <- "Consultation with health care workers"

d$info_need_w2_authority_websites <- grepl("Government or health authority websites", d$info_need_w2)
attr(d$info_need_w2_authority_websites, "label") <- "Government or health authority websites"

d$info_need_w2_search_engines <- grepl("Search engines", d$info_need_w2)
attr(d$info_need_w2_search_engines, "label") <- "Search engines"

d$info_need_w2_social_media <- grepl("Social media", d$info_need_w2)
attr(d$info_need_w2_social_media, "label") <- "Social media"

info_need_items <- grepl("info_need_w2", names(d))
d[is.na(d$info_need_w2), info_need_items] <- NA
d <- dplyr::select(d, -info_need_w2)

info_need_w2_14_text should be retained by itself as a text item.