Displaying 1 result from an estimated 1 matches for "fooornull".
Did you mean:
aovornull
2011 May 04
1
General "nil" reference class object
...union is created:
> Foo <- setRefClass("Foo")
> Bar <- setRefClass("Bar", fields=list(foo="Foo"))
> Bar$new(foo=NULL)
Error in as(value, "Foo") :
no method or default for coercing "NULL" to "Foo"
> setClassUnion("FooOrNull", c("Foo","NULL"))
[1] "FooOrNull"
> Bar <- setRefClass("Bar", fields=list(foo="FooOrNull"))
> Bar$new(foo=NULL)
An object of class "Bar"
<environment: 0x10392c4a0>
> is.null(Bar$new(foo=NULL)$foo)
[1] TRUE
Other la...