Being lazier with code

Is there a way to “pass” the following code so that you don’t have to write our “scores$” for every column? There must be a way to type less…

match_summary <- str_c(scores$win_country, “beat”, scores$lose_country, “on”, scores$match_month, scores$match_day, “2014 with scores of”, scores$win_goals, “to”, scores$lose_goals, sep = " ")

1 Like

Hi @jeffrey1,

I cannot make it shorter, however this can avoid using scores$ every time:

match_summary <- scores %>% mutate(match_summary = str_c(win_country, "beat", lose_country, "on", match_month, match_day, "2014 with scores of", win_goals, "to", lose_goals, sep = " ")) %>% pull(match_summary)