Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(data.table)
- x <- c(1:5, NA, rep(NA, 3), 2:7)
- x[!between(x, 3, 7)] <- NA
- x
- # [1] NA NA 3 4 5 NA NA NA NA NA 3 4 5 6 7
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement