Message-ID: <F1F13E14A610474196571953929C02090C0FA308@ex08.net.ucsf.edu>
Date: 2016-04-22T20:38:57Z
From: Boylan, Ross
Subject: S4 non-virtual class with no slots?
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