Closed mronkko closed 7 months ago
Thanks. The example above now gives the following:
res <- runSimulation(design=Design, replications=1000, generate=Generate,
analyse=Analyse, summarise=Summarise)
Design: 1/4; RAM Used: 259.9 Mb; Replications: 1000; Total Time: 0.00s
Conditions: N=100
| | 0 % ~calculating
Error: Invalid object returned from Analyse()
Can you adjust the error a bit: Instead of saying "invalid object", can you modify it to tell what kind of object is expected and what was returned instead?
Sure, though I don't see any reason to return the class of the original object returned. Here's what is returned now:
> res <- runSimulation(design=Design, replications=1000, generate=Generate,
+ analyse=Analyse, summarise=Summarise)
Design: 1/4; RAM Used: 267.9 Mb; Replications: 1000; Total Time: 0.00s
Conditions: N=100
| | 0 % ~calculating
Error: Analyse() must return a numeric vector, list, or data.frame
Thanks. This helps a lot. I was thinking that returning the class name would give even more information that can help in understanding the error in how the analyse function is defined.
The package should provide an informative error message when the generate or analyse functions do not return valid outputs.
Here is a test case that produces a non-informative error