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 essential.

Problem:
EmptyFitResult <- setClass("EmptyFitResult", representation=representation())
# 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.

Context:
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.

Thanks.
Ross Boylan

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to