Stuck on this code
library(dplyr) library(stringr) pattern <- "(?i)(\\w+SQL)" hn_sql <- hn %>% filter(str_detect(title, pattern)) %>% mutate(flavor = str_match(title, pattern)[,2]) %>% mutate(flavor = str_to_lower(flavor)) hn_sql_flavor_avg <- hn_sql %>% select(flavor, num_comments) %>% group_by(flavor) %>% summarise(avg = mean(num_comments))
What I expected to happen:
I expect it to create a data frame hn_sql that filters titles from the hn dataset which includes the designated pattern and then create a column for flavor and convert the titles to lowercase.
What actually happened:
I am getting a message that my code caused an error and the data frame returned by that section is different than expected.
∑marise() ungrouping output (override with .groups argument)
This is my first time ever posting, so please let me know if I haven’t formatted it correctly. I can’t figure out what I am overlooking here…