[R] namespaces

Gabor Grothendieck ggrothendieck at gmail.com
Thu Oct 2 17:19:47 CEST 2008


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