"This warning is displayed once every 8 hours." How to not wait 8 hours to verify fix?

An example of this warning is shown on this RPubs page.

## Warning: `as_data_frame()` is deprecated as of tibble 2.0.0.
## Please use `as_tibble()` instead.
## The signature and semantics have changed, see `?as_tibble`.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.

While being well-intentioned, this warning can come from somewhere in a large data pipeline and the fix may not be as simple as using "as_tibble" instead of "as_data_frame" as suggested -- because I'm not using "as_data_frame" anywhere in my code. So, I make what I suspect is a likely fix (in my case a column name was assigned to be ""), but then I cannot test the fix until 8 hours has passed?

How can I force this warning to always appear so I can immediately know I fixed the problem and have eliminated the warning instead of waiting 8 hours to verify?

3 Likes

You could restart your R session. That will force the warning to re-appear.

This warning is produced using the lifecycle package. You can control the verbosity of these messages using options(), as described in ?lifecycle::verbosity.

# A soft deprecation warning shown every 8 hours
lifecycle::deprecate_soft("0.1.0", "deprecated_function()")
#> Warning message:
#>   `deprecated_function()` is deprecated as of lifecycle 0.1.0.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_warnings()` to see where this warning was generated. 

# Not shown twice within 8 hours
lifecycle::deprecate_soft("0.1.0", "deprecated_function()")

# Set lifecycle_verbosity to 'warning', ensuring deprecated messages are shown.
options(lifecycle_verbosity = "warning")

# Deprecation signal is given as a warning, even within 8 hours
lifecycle::deprecate_soft("0.1.0", "deprecated_function()")
#> Warning: `deprecated_function()` is deprecated as of lifecycle 0.1.0.

Created on 2020-08-03 by the reprex package (v0.3.0)

4 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.