remove all variables except 1 in r code example Example: how to keep only certian objects python rm(list=setdiff(ls(), "x"))