[R] remove objects(1-20, 25-30) OR remove objects(...) except(...)??

John Fox jfox at mcmaster.ca
Thu Jul 25 16:21:12 CEST 2002

Dear Ulrich,

rm(list=ls()[c(1:20, 25:30)]

should do what you want (If I understand the question correctly).


At 01:58 PM 7/25/2002 +0200, you wrote:
>Dear list,
>I would like to do a remove like either
>remove objects(1-20, 25-30) OR remove objects(...) except(...)
>I only found the approach rm(pat=) which is not suitable as there would be 
>too many patterns.
>Can I also remove objects by their given number in ls() or do a remove but 
>exclude certain objetcs?
>Regards, Ulrich

John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list