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

Debugging is made complicated by warning/messages only displayed once per session #5206

Closed
bguiastr opened this issue Feb 25, 2023 · 4 comments

Comments

@bguiastr
Copy link

Hi,

I am the maintainer of a package which is heavily depending on ggplot2. However, I just had the most difficult time fixing the warning:

#> Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
#> Please use `linewidth` instead.

The reason was that this message returned by deprecate_soft0() is only displayed once per session (or every 8 hours) which made it very difficult for me to pinpoint the source of the issue (i.e. I had to keep restarting R to find and reproduce the issue).

While I clearly see the reasoning for messages/warning to the users, in my opinion it would make sense to have something like options(tidyverse.debug = TRUE) which would keep the messages/warnings turned on for developpers.

Please note that this issue is also applicable to other tidyverse packages such as dplyr, rlang::warn(), etc.

@yutannihilation
Copy link
Member

Hi, ggplot2 uses lifecycle package to manage these warnings and messages. You can control lifecycle_verbosity.

cf., https://lifecycle.r-lib.org/reference/verbosity.html

library(ggplot2)

l <- geom_line(size = 10)
#> Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
#> ℹ Please use `linewidth` instead.

# no warning for the second time
l <- geom_line(size = 10)

# you can see the warning again
options(lifecycle_verbosity = "warning")
l <- geom_line(size = 10)
#> Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
#> ℹ Please use `linewidth` instead.

Created on 2023-02-25 with reprex v2.0.2

@bguiastr
Copy link
Author

@yutannihilation thanks a lot this is super useful, I would then suggest referencing this in the ggplot2 in packages vignette.

@yutannihilation
Copy link
Member

Hmm, I have no idea how it should be documented. As it's a topic not specific to ggplot2, I'm not sure if ggplot2's vignette is the right place.

@teunbrand
Copy link
Collaborator

I agree. If the suggestion here is to omit lifecycle warnings more often, or add instructions about the verbosity in the message, then perhaps it would be best to file an issue with the lifecycle package. I'll close this issue here because it appears more closely related to the lifecycle messages.

@teunbrand teunbrand closed this as not planned Won't fix, can't repro, duplicate, stale Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants