Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and revise name repair (#469)
Fixes #463 Exposure (or lack thereof) of syntactic argument in tibble() and as_tibble() Fixes #461 Advertise .tidy_names Fixed #446 Justify tidy_names --- Other name-related tibble issues * Finalize interface of `.name_repair = <A_FUNCTION>` #476 *let's decide/discuss there* * tibble doesn't make it easy to get variable names that match our style guide #472 *let's solve in follow-up PR* * names<- method should protect against invalid names #466 *let's solve in follow-up PR* * Move name repair to vctrs #464 *PR lays groundwork for this long-term goal* * revisit strategy for making names syntactic #459 *let's solve in follow-up PR* * Re-encode character columns and column names to UTF-8 #87 *relevant, but I don't touch this* Related issue in [tidyverse/principles](https://github.com/tidyverse/principles): * [Vector names](tidyverse/design#4) --- Overview: * Defines and motivates 3 levels of repaired names: - `minimal`: not `NULL`, no `NA`s, à la `rlang::names2()` - `unique`: `minimal` + no `""`s and no dupes (cf `tidy_names(syntactic = FALSE)`) - `syntactic`: `unique` + syntactic (cf `tidy_names(syntactic = TRUE)`) * Internal utility functions for each level of name repair, i.e. all combinations of "repair vs check" and "operate on the names vs the named vector". * `tibble()` and `as_tibble()` expose name repair via `.name_repair`. Replaces `.tidy_names` (piloted only in dev) and `as_tibble(..., validate = TRUE/FALSE)` (in CRAN version). * Default behaviour (`.name_repair = "assert_unique")`): do no repair but check that the names are `unique`. * `.name_repair = "none"` means just make sure the names are `minimal` * `.name_repair = "unique"` and `.name_repair = "syntactic"` mean what you think * `.name_repair` can also take a user-supplied function. --- To discuss: * ~Should `valid` just be `unique`?~ YES and I have made it so in the source. * Let us review the "names degrees of freedom" and facilities offered by base, tidyverse for independent control: - exist or not - unique or not - syntactic or not * Automatic naming, based on expression. We currently offer no control over this in `tibble()`. * How much to reveal re: long-term plans. For example, why `tidy_names()` and `set_tidy_names()` are still here, but haven't gained the obvious counterparts like `unique_names()` and `set_syntactic_names()`. Do we need a Life Cycle section in the docs? * My backwards compatibility report
- Loading branch information
Showing
17 changed files
with
935 additions
and
352 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
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
Oops, something went wrong.