Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. ID col1 col2 x
  2. 1 Ball a No
  3. 2 NA c Yes
  4. 3 Bat b Unknown
  5.  
  6. mutate(x = case_when(
  7. is.na(col1) == TRUE ~ "Yes",
  8. !is.na(col1) == TRUE & (col2 %in% c("a", "b")|
  9. (col2 == "YES" & x == "Unknown" ) == TRUE ) ~ "No"),
  10. TRUE ~ "Unknown"
  11. ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement