This is my df:
mydf <- structure(list(Action = c("Passes accurate", "Passes accurate",
"Passes accurate", "Passes accurate", "Lost balls", "Lost balls (in opp. half)",
"Passes (inaccurate)", "Interceptions (in opp. half)", "Interceptions",
"Positional attacks")), row.names = c(NA, -10L), class = c("tbl_df",
"tbl", "data.frame"))
I have this vector: passes <- c('Passes','passes','Assists','Crosses')
I am trying to do this: mydf %>% mutate(newcol = case_when(str_detect(Action, passes) ~ 'passes'))
But I only have the frst row filled with passes. I should have for example the first 4 rows filled with passes. Also the 7th row. How can I achieve this with case_when function?