[Rd] S4 class slot name 'names' is not allowed (PR#8768 S4Methods)
marsh at uri.edu
marsh at uri.edu
Thu Jun 15 17:45:38 CEST 2006
Hello,
Besides the problem with using "names," one has a similar problem using
".Data" together with "VIRTUAL."
Consider the top of p. 295 of the green book. This should work (I had to
change "structure" to "junk" because "structure" is a sealed class
definition):
setClass("junk",
representation(.Data="vector",VIRTUAL))
but this is what one gets
setClass("junk",
+ representation(.Data="vector",VIRTUAL))
Error in representation(.Data = "vector", VIRTUAL) :
object "VIRTUAL" not found
Now consider p. 5 of "S4 Classes in 15 pages, more or less." This should
work:
setClass("myVclass", representation(a = "character", "VIRTUAL"))
and indeed it does:
setClass("myVclass", representation(a = "character", "VIRTUAL"))
[1] "myVclass"
The need to quote "VIRTUAL" is the first bug, but read on.
Now take the above example, and change the first slot's name to ".Data."
Now, one gets:
setClass("myVclass", representation(.Data = "character", "VIRTUAL"))
Error in makePrototypeFromClassDef(properties, ClassDef, immediate,
where) : in constructing the prototype for class "myVclass": prototype has
class "list", but the data part specifies class "character"
So "names" is not the only problematic slot name.
Marshall Feldman
Dr. Marshall Feldman
Acting Director of Research and Academic Affairs
Center for Urban Studies and Research
The University of Rhode Island
80 Washington Street
Providence, RI 02903-1819
email: marsh @ uri.edu (remove spaces)
telephone: (401) 277-5218
fax: (401) 277-5099
More information about the R-devel
mailing list