[R] test to see if a s4 property is assigned?

Martin Morgan mtmorgan at fhcrc.org
Thu Sep 16 19:30:27 CEST 2010


On 09/15/2010 12:03 PM, darckeen wrote:
> 
> Class("person",representation(age="numeric",weight="numeric"))
> [1] "person"
>> bob <- new("person",age=30)
>> is.null(bob at weight)
> [1] FALSE
>> bob at weight
> numeric(0)
>> bob at weight == numeric(0)
> logical(0)

Hi darckeen -- use the prototype argument to setClass to assign a
default value, and test for that. Martin

> 
> How can i test to see if a s4 property is assigned?
>



More information about the R-help mailing list