[R] namespaces
Alexy Khrabrov
deliverable at gmail.com
Thu Oct 2 17:26:51 CEST 2008
Yes, I could prefix everything with taskN$, but that's boring! Can I
now attach and detach tasks to have one prefix-less, since they look
like dataframes? What does proto buy us?
To respond to Uwe here as well, I want dynamic task switching and
*also* an ability to load and save task from their workspaces into
their namespaces in the same R session.
Cheers,
Alexy
On Oct 2, 2008, at 11:19 AM, Gabor Grothendieck wrote:
> You could have an environment for each task and place your objects for
> each task in its environment.
>
> Note that this is getting close to object oriented ideas where each
> enviroment/task
> is an object containing your R variables and methods and the proto
> package
> can be used to facilitate that:
>
> library(proto)
> task1 <- proto(var = 0, addx = function(this, x) this$var <- this
> $var + x)
> task1$var # 0
> task1$addx(3)
> task1$var # 3
>
> On Thu, Oct 2, 2008 at 11:03 AM, Alexy Khrabrov
> <deliverable at gmail.com> wrote:
>> I'd like to control my namespace thoroughly, separated by task. Is
>> there a
>> way, in R session, to introduce namespaces for tasks dynamically
>> and switch
>> them as needed? Or, is there a combination of load/save workspace
>> steps
>> which can facilitate this?
>>
>> Cheers,
>> Alexy
>>
>> ______________________________________________
>> 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