DS4PS / ays-r-coding-sum-2022

Introductory data science course in R, taught at the Andrew Young School GSU.
http://ds4ps.org/ays-r-coding-sum-2022/
2 stars 2 forks source link

Lab 6 1.2 #13

Open kyarosiuk1 opened 2 years ago

kyarosiuk1 commented 2 years ago

I am struggling with part 1 q2...I might be overthinking it...are we to create group_indices in this one and then filter on unique "Example" only? below is what i have...but I am sure it is probably wrong...can you please provide some more guidance?

group_by(dat, 'Title', 'Example') dat$group_id <- data.frame(group_indices(dat, 'Example'))

dat <- distinct(dat, 'Example', .keep_all = TRUE)

jamisoncrawford commented 2 years ago

Are you using the Summer 2022 Lab 06?

https://cssearcy.github.io/AYS-R-Coding-SPR-2020/LABS/Lab-06-Instructions_v3.html#Joining_Tables

jamisoncrawford commented 2 years ago

Sorry, I saw dat used and thought it might have been from an older version of the lab.

So after you've joined your data, you might approach this with a group_by() and summarize() operation.

joined_data %>%
    group_by(`SOC Code`, `Title`) %>%
    summarize(n_techs = n(),
              hot_perc = mean(ifelse(HotTechnology == "Y",
                     TRUE, FALSE))) %>%
    filter(n_techs >= 15)
jamisoncrawford commented 2 years ago

Reopening so others can see.