DoseResponse / drc

Fitting dose-response models in R
https://doseresponse.github.io/drc/
21 stars 16 forks source link

reset options(warn) in drm() on exit #9

Closed Farbfetzen closed 4 years ago

Farbfetzen commented 4 years ago

I like to use options(warn=1) in my scripts. But after calling drm() the value is set to 0. That's because drm() modifies it and this change persists after the function exits. It is not very nice to mess with the users options. Please cache them and reset them with on.exit, thank you.

Example:

library(drc)
options(warn = 1)
getOption("warn")  # prints 1
drm(c(9, 8, 2, 1) ~ c(1, 2, 3, 4), fct = W1.3())
getOption("warn")  # prints 0
daniel-gerhard commented 4 years ago

all options() calls should now reset on.exit. Thanks!

Farbfetzen commented 4 years ago

Wow, that was fast. Thank you.