Re: [Rd] Names of a data set in a package

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Tue, 05 Apr 2011 12:25:19 -0400

2011/4/5 Göran Broström <gb_at_stat.umu.se>:
> For some reason I want to let one data set in a package be known under two
> different names.  Is that possible, and if so, how? I do not want to have
> two copies of the data set in the package.
>

This will allow you to read the data frame under a different name but you won't be able to modify it under the different name. We make use of the built in data frame BOD and create the alternate name BOD2:

> makeActiveBinding("BOD2", function() BOD, .GlobalEnv)
> BOD$Time

[1] 1 2 3 4 5 7
> BOD2$Time

[1] 1 2 3 4 5 7
> # changing BOD also changes BOD2
> BOD$Time[1] <- 99
> BOD2$Time

[1] 99 2 3 4 5 7

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue 05 Apr 2011 - 16:28:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 05 Apr 2011 - 19:10:41 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive