uclahs-cds / package-BoutrosLab-plotting-general

Functions to Create Publication-Quality Plots
https://uclahs-cds.github.io/package-BoutrosLab-plotting-general
12 stars 4 forks source link

`create.histogram` should restore `options(warn)` to original value #190

Open nwiltsie opened 3 months ago

nwiltsie commented 3 months ago

create.histogram temporarily disables warnings...

https://github.com/uclahs-cds/package-BoutrosLab-plotting-general/blob/54fb8b7afc3571c5ce804db2a46e05a18136a1d0/R/create.histogram.R#L41-L44

... but it then restores the default 0, rather than whatever value had been set:

https://github.com/uclahs-cds/package-BoutrosLab-plotting-general/blob/54fb8b7afc3571c5ce804db2a46e05a18136a1d0/R/create.histogram.R#L67-L68

It should instead capture and restore the original value:

original.warn <- getOption('warn');
options(warn = -1);

...

options(warn = original.warn);