Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ID col1 col2 x
- 1 Ball a No
- 2 NA c Yes
- 3 Bat b Unknown
- mutate(x = case_when(
- is.na(col1) == TRUE ~ "Yes",
- !is.na(col1) == TRUE & (col2 %in% c("a", "b")|
- (col2 == "YES" & x == "Unknown" ) == TRUE ) ~ "No"),
- TRUE ~ "Unknown"
- ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement