[R] setMethod and contains not saving

Joseph Wang joe at confucius.gnacademy.org
Fri Feb 24 03:36:28 CET 2006


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"




More information about the R-help mailing list