imagine I have a simple tibble:
tribble(~a,~b,~c,
1, "def", "abc",
2, "def", "def")
I want to mutate a new column "d" with values conditioned on whether a string exists in all other columns. In this case, I'm looking for the string "abc". The final output would look like:
tribble(~a,~b,~c,~d,
1, "def", "abc", "present",
2, "def", "def", "absent")
In reality my tibble has ~20 columns, of which maybe 10 are character, and the strings I'm looking for are more complex, like "[Aa]|[Cc]"
. I'm sure there's a simple-ish way with pmap,case_when and str_detect but can't work it out at all!