[R] S4 non-virtual class with no slots?

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Fri Apr 22 23:15:44 CEST 2016

Isn't this why NULL is different than NA?

Alternatively,  what about using a data frame with no rows? 
Sent from my phone. Please excuse my brevity.

On April 22, 2016 1:38:57 PM PDT, "Boylan, Ross" <Ross.Boylan at ucsf.edu> wrote:
>It seems that if an S4 class has no slots it can't be instantiated
>because it is assumed to be virtual.  Is there a way around this other
>than adding a do-nothing slot?  A singleton would be OK, though is not
>EmptyFitResult <- setClass("EmptyFitResult",
># also tried it without the second argument.  same result.
> > e <- EmptyFitResult()
> Error in new("EmptyFitResult", ...) :
>   trying to generate an object from a virtual class ("EmptyFitResult")
>This in R 3.1.1.
>I fit simulated data; in some simulations none survive to the second
>stage of fitting.  So I just need a way to record that this happened,
>in a way that integrates with my other non-null results.
>Ross Boylan
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]

More information about the R-help mailing list