[R] Clear selected objects from workspace

Bea GD aguitatierra at hotmail.com
Wed Apr 23 12:20:04 CEST 2014


Thank you a lot Jim. Much cleaner now!


On 23.04.2014 12:01, Jim Lemon wrote:
> On 04/23/2014 07:54 PM, Bea GD wrote:
>> 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="")))
>>
> Hi Beatriz,
> Try this:
>
> rm(list=paste("TT",1981:2010,"1",sep="_"))
>
> Jim
>
>




More information about the R-help mailing list