pveber / morse

Companion R package for MOSAIC website
7 stars 5 forks source link

problem for dispatch in plotDoseResponse methods #271

Closed virgile-baudrot closed 6 years ago

virgile-baudrot commented 6 years ago

Method plotDoseResponseis only define for object of class reproData and survFitCstExp. However, the function plotDoseResponse try to do it on an object of class survFitVarExp. Maybe returning a manual error message would be better.

The following code return a graph but should return an error message because it is impossible to plot a dose-response when one or more exposure profile are variable:

library(morse)
data("propiconazole_pulse_exposure")
survDate_PRZ_var <- survData(propiconazole_pulse_exposure)
plotDoseResponse(surcDate_PRZ_var)
pveber commented 6 years ago

The problem was that the function called in the case of survDataCstExp was wrongly named plotDoseResponse.survData. Now the example you provide yells with the proper error message:

> plotDoseResponse(survDate_PRZ_var)
Error in UseMethod("plotDoseResponse") : 
  pas de méthode pour 'plotDoseResponse' applicable pour un objet de classe "c('survDataVarExp', 'survData', 'tbl_df', 'tbl', 'data.frame')"

Thanks!