[R] Remove objects names like character String

Katharina May may.katharina at googlemail.com
Tue May 19 16:48:02 CEST 2009


thanks to all your solutions, works out perfectly!


2009/5/19 Henrique Dallazuanna <wwwhsd at gmail.com>:
> Try this:
>
> rm(list=ls(patt="site[0-9]$"))
>
> On Tue, May 19, 2009 at 7:47 AM, Katharina May
> <may.katharina at googlemail.com> wrote:
>>
>> Hi,
>>
>> how can I use rm() on objects named like:
>> paste("site",i,"_data",sep="") while looping
>> through i?
>> I tried rm(paste("site",i,"_data",sep="")) but I get the error that
>> rm() must contain names or
>> text strings which is confusing me as I thought paste() would create
>> something like that...?
>>
>> Thanks,
>>
>>
>>         Katharina
>>
>>
>>
>> --
>> Time flies like an arrow, fruit flies like bananas.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>



-- 
Time flies like an arrow, fruit flies like bananas.




More information about the R-help mailing list