Re: [R] wildcards and removing variables

From: Marc Schwartz (via MN) <mschwartz_at_mn.rr.com>
Date: Tue 11 Oct 2005 - 00:54:05 EST

On Mon, 2005-10-10 at 10:37 -0400, 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@miami.edu

See ?ls, which has a 'pattern' argument, enabling the use of Regex to define the objects to be listed and subsequently removed using rm().

You can then use something like:

  rm(list = ls(pattern = "\\bresults."))

HTH, Marc Schwartz



R-help@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 Received on Tue Oct 11 00:57:24 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:41 EST