[R] Clear selected objects from workspace

Bea GD aguitatierra at hotmail.com
Wed Apr 23 11:54:06 CEST 2014


Dear R users,

I've got over a hundred R objects in the workspace. They all follow a 
pattern for years and months. Like this:
TT_1981_1, TT_1981_2, TT_1981_3, . . . . TT_1981_12
.
.
.
TT_2010_1, . . .

If now, I'd like to remove a selection of them, how is the best way to 
do it? Currently I need to use a big chunk of code.

I've tried various things but they don't work.
For instance:
rm(paste("RR_", 1981:2010, "_1", sep=""))
rm(list(paste("RR_", 1981:2010, "_1", sep="")))

I'd be great if you have any ideas that you think may help.

Thanks a lot!

Beatriz




More information about the R-help mailing list