Commit a99bfd9
authored
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" names1 parent 7dfe606 commit a99bfd9
File tree
7 files changed
+1735
-314
lines changed- R
- man
- tests/testthat
- _snaps
7 files changed
+1735
-314
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
3 | 22 | | |
4 | 23 | | |
5 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
193 | 200 | | |
194 | | - | |
| 201 | + | |
195 | 202 | | |
196 | 203 | | |
197 | 204 | | |
| |||
259 | 266 | | |
260 | 267 | | |
261 | 268 | | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | 269 | | |
310 | 270 | | |
311 | 271 | | |
| |||
0 commit comments