Hi,
One way of doing object-oriented programming in R is to use function
environment to hold object's data, see for example
@Article{Rnews:Chambers+Lang:2001a,
author = {John M. Chambers and Duncan Temple Lang},
title = {Object-Oriented Programming in {R}},
journal = {R News},
year = 2001,
volume = 1,
number = 3,
pages = {17--19},
month = {September},
url = http,
pdf = Rnews2001-3
}
One deficiency of this approach is that dput() does not export all data
pertained to the object. For example
> objfactory <- function(nm) {
+ list(name = function() nm)
+ }
>
>
> obj <- objfactory('foo')
>
> obj$name()
[1] "foo"
> dput(obj)
structure(list(name = function ()
nm), .Names = "name")
As one can see the data piece of the obj, nm='foo', is not exported. Is there a
way to modify the original approach so that dput() will produce a
self-sufficient dump of the object?
Thanks,
Vadim
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel