From gb at stat.umu.se  Wed Apr  6 00:23:01 2011
From: gb at stat.umu.se (=?iso-8859-1?Q?G=F6ran_Brostr=F6m?=)
Date: Wed, 6 Apr 2011 00:23:01 +0200
Subject: [Rd] Names of a data set in a package
In-Reply-To: <BANLkTi=bf2wpvhDKFSeukGFvTixW-CoLbA@mail.gmail.com>
References: <4D9B2C92.4000707@stat.umu.se>
	<BANLkTimfM4V4X=F2xgSs2VskdhrMmGQjPQ@mail.gmail.com>
	<211B9B55-CC70-4AC0-8DDE-98C808055921@stat.umu.se>
	<BANLkTi=bf2wpvhDKFSeukGFvTixW-CoLbA@mail.gmail.com>
Message-ID: <0F12BA3D-89A0-441A-95CB-9B20D2EA529E@stat.umu.se>


5 apr 2011 kl. 21.01 skrev Gabor Grothendieck:

> 2011/4/5 G?ran Brostr?m <gb at stat.umu.se>:
>> 
>> 5 apr 2011 kl. 18.25 skrev Gabor Grothendieck:
>> 
>>> 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
>>> 
>> Thanks Gabor, but where do I put this in my package? To clarify, I want
>> 
>>> data(B, package = "A")
>> 
>> and
>> 
>>> data(C, package = "A")
>> 
>> refer to the same data set.
>> 
> 
> Implement your datasets as .R files.  See ?data and the source to the
> quantreg package, say, as it uses .R files for its data.

Gabor, thanks again, I got it! Note though that quantreg nowadays uses .rda files for its data. But in an old version I found the way to do it.

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



[Rd] Names of a data set in a package
=?iso-8859-1?Q?G=F6ran_Brostr=F6m?=