I want to create another column which gives 1 if one of the words in the pattern is present in the column RoleName OR FulltextDescription, this is because it might be that the RoleName only says 'VP' while the FulltextDescription says that the person is VP of the cyber department.
My code right now looks like this:
pattern <- paste(c("cyber", "Cyber", "technology", "Technology", "computer", "Computer"), collapse = "|")
IPEm <- IPEm %>%
mutate(`Cyber Job` = ifelse(str_detect(RoleName|FulltextDescription, pattern), 1, 0))
But unfortunately it doesn't work
OR
|is a logical operator that works on booleans--things that are TRUE or FALSE.You can't (meaningfully) use
|on a column unless that column is boolean (or you want it to be treated as boolean).You can
|the results ofstr_detectbecausestr_detectreturns a boolean TRUE or FALSE:You could also concatenate the text with
pasteand do a singlestr_detecton the combined text: