[R] renaming objects

Gabor Grothendieck ggrothendieck at gmail.com
Tue Mar 4 00:00:58 CET 2008


This does not really answer your question but the following
lets you refer to an object by a second name although the object
still has its original name as well.

> a <- 3
> makeActiveBinding("b", function() a, .GlobalEnv)
NULL
> b
[1] 3
> a <- 4
> b
[1] 4


On Mon, Mar 3, 2008 at 4:20 PM,  <Giles.Crane at doh.state.nj.us> wrote:
>
> Is there a way to rename R objects?
> I am looking for a way to rename objects
> without making new objects.
>
> #For example:
> x = c(1:40)
> # I wish to use a function to rename x, already created, to y, perhaps by
> obj.rename(x,y)
> # or
> obj.rename("x","y")
>
> There are numerous examples of renaming
> variables (columns) in dataframes, but I have
> found no methods for renaming objects.
> The functionassign() does not do this.
>
> Thank you for any help you can give.
> Cordially
>
> Giles Crane, M.Phil., MPH
> Research Scientist & Statistician
> New Jersey Department of Health & Senior Services
> Tel 609 292-8012, -5666
> Fax 609 292-9288
> giles.crane at doh.state.nj.us
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list