edquant / edh7916

Course materials and website for EDH7916: Contemporary Research in Higher Education
https://edquant.github.io/edh7916/
3 stars 1 forks source link

Question 3 part 1 #17

Closed jharsell closed 4 years ago

jharsell commented 4 years ago

Hi All,

I am completely stuck on trying to search for the institutional name within the mission, here is one of the variations of code I ran:

df_sum <- df_joined %>%
    mutate(instnm_in_miss = str_replace(mission, "([university]+)(-[college]+)?", "\\1")) %>%
    count(instnm_in_miss)

Am I way off in left field or not in the ballpark?

Thanks, Jaime and Dr. Quack (my duck)

inmanjes commented 4 years ago

Hey Jaime,

I attempted to have the code read in whatever was in the instnm column and look for it in the mission column (I didn't mutate and create a new column). Here's the code I ran:

df %>%

## isolate the two columns I need
select(instnm, mission) %>%

## filter just the institutions with an actual mission statement
filter(!is.na(mission)) %>%

## use string detect to look for a pattern and keep those that do contain the pattern (in the mission column, look for instnm)
filter(str_detect(mission, instnm)) %>%

## tell me how many there are 
count()

I got an answer that seems reasonable, close to half of those with mission statements include the name of the institution. What did other people find?

jharsell commented 4 years ago

Thank you for sharing, I appreciate your help Jess!

btskinner commented 4 years ago

Thanks for the assist, @inmanjes!

I'm closing this now, but anyone feel free to reopen if you have more questions.