Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nwiltsie opened this issue Aug 29, 2024 · 0 comments
Open

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

nwiltsie opened this issue Aug 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@nwiltsie
Copy link
Member

create.histogram temporarily disables warnings...

# 'data' parameter shoud only be set if x if a formula
# otherwise a warning will be thrown (even if data = NULL), although the plot will still be created
# temporarily turn off warnings to avoid confusion
options(warn = -1);

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

# turn warnings back on
options(warn = 0);

It should instead capture and restore the original value:

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

...

options(warn = original.warn);
@nwiltsie nwiltsie added the bug Something isn't working label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant