setMethod and contains not saving

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

setMethod and contains not saving

Joseph Wang
Sorry if this is a duplicate....

I'm having the following problem saving methods which are subclasses of other
objects.  Is there a workaround.  The problem is that the R file that
triggers this bug is several meg, and I'd like to load from a RData file.

This works

> setClass('foo')

[1] "foo"

> setMethod('$', 'foo', function(x,name) x)

[1] "$"

> showMethods('$')

Function "$":
x = "ANY"
x = "foo"

> q()

Save workspace image? [y/n/c]: y
(restart)

> showMethods('$')

Function "$":
x = "ANY"
x = "foo"

This doesn't ....

> setClass('bar', contains='foo')

[1] "bar"

> setMethod('$', 'bar', function(x,name)x)

[1] "$"

> showMethods('$')

Function "$":
x = "ANY"
x = "foo"
x = "bar"

> q()

Save workspace image? [y/n/c]: y
(restart)

> showMethods('$')

Function "$":
x = "ANY"

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html