I have a data frame 'fol_all' with field 'folno'. I have a list called string_detect with list of strings I want to flag in fol_all if they are present in folno.
folno <- c('123denied', 'attached_as_test', 'dept_224', 'bulked_up', 'wsd2273')
fol_all <- data.frame(folno)
string_detect <- c('denied', 'attach', 'bulk')
folno <- folno %>%
mutate(folno_flag = case_when(str_detect(folno, string_detect)) == T ~ 1, T == 0)
In this example, rows 1, 2, and 4 would return a 1 and the rest a 0.
I get the following error - please help.
Error in UseMethod("mutate") :
no applicable method for 'mutate' applied to an object of class "character"