[R] wildcards and removing variables

Roger D. Peng rpeng at jhsph.edu
Mon Oct 10 17:03:15 CEST 2005


In R 2.2.0, there is the function 'glob2rx()' which can be used for this 
purpose.  As in

rm(list = ls(pattern = glob2rx("results*")))

-roger

Afshartous, David wrote:
> 	All,
> 
> 	Is there are a wildcard in R for varible names as in unix?  For example,
> 
> 	rm(results*)
> 
> 	to remove all variable or function names that begin w/ "results"?  
> 
> 	cheers,
> 	Dave
> 	ps - please respond directly to afshar at miami.edu 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/




More information about the R-help mailing list