04pallav
10/11/2017 - 10:41 PM

remove all variables except some

remove all variables except some

library(gdata)
> keep(a) #shows you which variables will be removed
[1] "b" "c"
> keep(a, sure = TRUE) # setting sure to TRUE removes variables b and c
> ls()
[1] "a"