[R] Is it possible (/reasonable) to write an as.RefClass function for R "list" class?

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Sat Jul 27 00:17:06 CEST 2013

Reference classes are implemented with environment objects, which are mutable. Once you convert to list, the converted object is not mutable, since there is no such thing as a mutable list. So I would say your request is not possible.
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

Tal Galili <tal.galili at gmail.com> wrote:
>Hello all.
>I am interested in creating a mutable "list" object in R.
>Ideally I would do it through something like this:
>x <- list(a = list(1:4), b = "miao", c = 4:1)
>x_RC <- as.RefClass(x)
>attr(x_RC[[2]], "I am") <- "string"
>x_RC[[3]] <- x_RC[[3]]+1
>x_new <- as.list(x_RC)
>Is that reasonably possible to create? Or does that make
>Contact me: Tal.Galili at gmail.com |
>Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew)
>www.r-statistics.com (English)
>	[[alternative HTML version deleted]]
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list