-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more error checking to
rename_with()
(#6574)
* Add more error checking to `rename_with()` * NEWS bullet * Use `length()` for simplicity and clarity
- Loading branch information
1 parent
b0fb0f8
commit e9f5b56
Showing
4 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# `.fn` result type is checked (#6561) | ||
|
||
Code | ||
rename_with(df, fn) | ||
Condition | ||
Error in `rename_with()`: | ||
! `.fn` must return a character vector, not an integer. | ||
|
||
# `.fn` result size is checked (#6561) | ||
|
||
Code | ||
rename_with(df, fn) | ||
Condition | ||
Error in `rename_with()`: | ||
! `.fn` must return a vector of length 2, not 3. | ||
|
||
# can't rename in `.cols` | ||
|
||
Code | ||
rename_with(df, toupper, .cols = c(y = x)) | ||
Condition | ||
Error in `rename_with()`: | ||
! Can't rename variables in this context. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters