Skip to content
Prev 31348 / 63424 Next

setClassUnion with numeric; extending class union

What warnings? Which part of the following is not what you're looking 
for? (The usual information is needed, like version of R, reproducible 
example, etc.)


 > setClassUnion("numericOrNULL", c("numeric","NULL"))
[1] "numericOrNULL"
 > setClass("foo", representation(x="numericOrNULL"))
[1] "foo"
 > ff = new("foo", x= 1:10)
 > fg = new("foo", x = NULL)
 >
 > ff
An object of class ?foo?
Slot "x":
[1] 1 2 3 4 5 6 7 8 9 10

 > fg
An object of class ?foo?
Slot "x":
NULL
 > fk = new("foo")
 > fk
An object of class ?foo?
Slot "x":
NULL

John
Sklyar, Oleg (London) wrote: