I am having difficulty using in 1.8.0 an object created under 1.7.1. The
following is a 'minimal example' of the issue. First the part in 1.7.1:
> require("methods")
[1] TRUE
> setClass("foo",representation("vector",label="character"))
[1] "foo"
> x <- new("foo",1:2,label=LETTERS[1:2])
> save(x,file="f:/temp/test_gh.171.Rdata")
Then in 1.8.0:
> require("methods")
[1] TRUE
> setClass("foo",representation("vector",label="character"))
[1] "foo"
> load("f:/temp/test_gh.171.Rdata")
> new("foo",x,[EMAIL PROTECTED])
Error in initialize(value, ...) : Initialize method returned an object of
class "foo" instead of the required class "foo"
> new("foo",[EMAIL PROTECTED],[EMAIL PROTECTED])
An object of class "foo"
[1] 1 2
Slot "label":
[1] "A" "B"
> y <- new("foo",1:2,label=LETTERS[1:2])
> new("foo",y,[EMAIL PROTECTED])
An object of class "foo"
[1] 1 2
Slot "label":
[1] "A" "B"
> attributes(class(x))
NULL
> attributes(class(y))
$package
[1] ".GlobalEnv"
> attributes(class(x)) <- attributes(class(y))
> new("foo",y,[EMAIL PROTECTED])
An object of class "foo"
[1] 1 2
Slot "label":
[1] "A" "B"
As far as I can see, the "class" attribute now has an attribute "package",
and the absence of this attribute in objects created under 1.7.1 causes the
problem. This lack of 'backward compatibility' has been flagged to me as a
bug in the package 'its' that I maintain on CRAN. I'm not sure it's a
bug... should I advise users to re-generate their stored objects using e.g.
new("foo",[EMAIL PROTECTED],[EMAIL PROTECTED])? Or is there something I am missing
altogether here?
TIA
Giles Heywood
OS: NT4
R.version
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 1
minor 8.0
year 2003
month 10
day 08
language R
**********************************************************************
This is a commercial communication from Commerzbank AG.\ \ T...{{dropped}}
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel