Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df<- data.frame(a = c(1,2,3,4,5),
- b = c(6,7,8,9,10),
- c = c(11,12,13,14,15),
- z = c("b","c","a","a","b"))
- a b c z
- 1 1 NA 11 b
- 2 2 7 NA c
- 3 NA 8 13 a
- 4 NA 9 14 a
- 5 5 NA 15 b
- If column name is equal to Z, replace value with NA
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement