-
Notifications
You must be signed in to change notification settings - Fork 2k
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
stat_smooth()
drops failed groups
#5371
Conversation
As an aside, is there some smart way to reduce repeated parts in the warnings? In particular, the call getting mentioned several times is a bit annoying and it would seem cleaner to just warn like so: #> Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
#> : span too small. fewer data values than degrees of freedom.
#> : at 0.9598
#> : radius 0.00010404
#> : all data on boundary of neighborhood. make span bigger
# etc...
#> Warning: Failed to fit group 1.
#> Caused by error in `predLoess()`:
#> ! NA/NaN/Inf in foreign function call (arg 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what we can do about the excessive warnings. Summarising them would require us to make some very hard expectations about the warnings coming from the call...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR aims to fix #5352.
Briefly, it wraps the fitting/predicting procedure in a
tryCatch()
block to rethrow errors as warnings and drops the group for which the procedure fails. This prevents one bad group stopping the fitting in all other groups.The example from #5352 with this PR (in particular, see the very last warning):
Created on 2023-07-27 with reprex v2.0.2