Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rectangling function rewrite (#1200)
* Implement `tidyr_chop2()` Since we don't have `vec_chop2()` yet r-lib/vctrs#1226 * Add `list_of_ptype()` helper for consistent list-of ptype extraction * Generalize `unchop_col_info()` into `list_init_empty()` This will be useful for an enhanced `simplify_col()` * Rename `tidyr_chop2()` to `tidyr_chop()` * Reimplement rectangling functions * NEWS bullet * Move details about `ptype` and `transform` to the `transform` param docs * Link to `list_of()` documentation * Mention recycling of `unnest_longer()` * Synchronize `values_to` and `indices_to` documentation * Replace "can't" with "must not" * Introduce `tidyr_temporary_new_list_of()` Because vctr objects can't currently have `""` names * Provide more input validation for `ptype` and `transform` * Add two tests about `names_sep`, provided by @mgirlich * Chop non-lists into lists with `vec_chop()` This uses more explainable vctrs tooling for converting non-primary data types (i.e. non-lists) into lists. This also seems to produce the expected output in more scenarios. Also inlined `tidyr_chop()` into `elt_to_wide()` since that is the only other place it was used. The fact that this removed a helper makes me optimistic that it is the right approach. * Test that df-cols result in list-ofs when `simplify = FALSE` * Apply unique name repair on names before applying `names_sep` Applying it before `names_sep` rather than after means that `""` and `NA_character_` names get repaired early on before they are combined with the prefix and `names_sep`, which can make them mistakently look like "valid" names
- Loading branch information