We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If you have an if statement with a large if and small else:
if
else
if (cond) { # # # # # # # # } else { something() }
It's worth considering flipping the order and using an early exit:
if (!cond) { return(something()) } # #
The text was updated successfully, but these errors were encountered:
Example from dbplyr:
check_groups <- function(.groups) { if (!is_null(.groups) && !.groups %in% c("drop_last", "drop", "keep")) { abort(c( paste0( "`.groups` can't be ", as_label(.groups), if (.groups == "rowwise") " for lazy tables" ), i = 'Possible values are NULL (default), "drop_last", "drop", and "keep"' )) } }
to
check_groups <- function(.groups) { if (is_null(.groups)) { return() } if (.groups %in% c("drop_last", "drop", "keep")) { return() } abort(c( paste0( "`.groups` can't be ", as_label(.groups), if (.groups == "rowwise") " in dbplyr" ), i = 'Possible values are NULL (default), "drop_last", "drop", and "keep"' )) }
Sorry, something went wrong.
.groups
summarise()
Some more stuff at https://www.geepawhill.org/2019/03/03/refactoring-pro-tip-easiest-nearest-owwie-first/
No branches or pull requests
If you have an if statement with a large
if
and smallelse
:It's worth considering flipping the order and using an early exit:
The text was updated successfully, but these errors were encountered: