Movatterモバイル変換


[0]ホーム

URL:


tidyr 1.3.1

tidyr 1.3.0

New features

Breaking changes

Lifecycle changes

Rectangling

Bug fixes and minorimprovements

General

Nesting, packing, andchopping

Pivoting

Missing values

tidyr 1.2.1

tidyr 1.2.0

Breaking changes

Pivoting

Nesting

Rectangling

Grids

Missing values

Bug fixes and minorimprovements

General

Pivoting

Nesting

Rectangling

Grids

Missing values

tidyr 1.1.4

tidyr 1.1.3

tidyr 1.1.2

tidyr 1.1.1

tidyr 1.1.0

General features

Pivoting improvements

Rectangling

Nesting

Bug fixes and minorimprovements

tidyr 1.0.2

tidyr 1.0.1

tidyr 1.0.0

Breaking changes

Seevignette("in-packages") for a detailed transitionguide.

Pivoting

Newpivot_longer() andpivot_wider()provide modern alternatives tospread() andgather(). They have been carefully redesigned to be easierto learn and remember, and include many new features. Learn more invignette("pivot").

These functions resolve multiple existing issues withspread()/gather(). Both functions now handlemulitple value columns (#149/#150), support more vector types (#333),use tidyverse conventions for duplicated column names (#496, #478), andare symmetric (#453).pivot_longer() gracefully handlesduplicated column names (#472), and can directly split column names intomultiple variables.pivot_wider() can now aggregate (#474),select keys (#572), and has control over generated column names(#208).

To demonstrate how these functions work in practice, tidyr has gainedseveral new datasets:relig_income,construction,billboard,us_rent_income,fish_encounters andworld_bank_pop.

Finally, tidyr demos have been removed. They are dated, and have beensuperseded byvignette("pivot").

Rectangling

tidyr contains four new functions to supportrectangling, turning a deeply nested list into a tidytibble:unnest_longer(),unnest_wider(),unnest_auto(), andhoist(). They aredocumented in a new vignette:vignette("rectangle").

unnest_longer() andunnest_wider() make iteasier to unnest list-columns of vectors into either rows or columns(#418).unnest_auto() automatically picks between_longer() and_wider() using heuristics basedon the presence of common names.

Newhoist() provides a convenient way of pluckingcomponents of a list-column out into their own top-level columns (#341).This is particularly useful when you are working with deeply nestedJSON, because it provides a convenient shortcut for themutate() +map() pattern:

df %>% hoist(metadata, name = "name")# shortcut fordf %>% mutate(name = map_chr(metadata, "name"))

Nesting

nest() andunnest() have been updated withnew interfaces that are more closely aligned to evolving tidyverseconventions. They use the theory developed invctrs to more consistently handlemixtures of input types, and their arguments have been overhauled basedon the last few years of experience. They are supported by a newvignette("nest"), which outlines some of the main ideas ofnested data (it’s still very rough, but will get better over time).

The biggest change is to their operation with multiple columns:df %>% unnest(x, y, z) becomesdf %>% unnest(c(x, y, z)) anddf %>% nest(x, y, z) becomesdf %>% nest(data = c(x, y, z)).

I have done my best to ensure that common uses ofnest()andunnest() will continue to work, generating aninformative warning telling you precisely how you need to update yourcode. Pleasefile an issueif I’ve missed an important use case.

unnest() has been overhauled:

Packing and chopping

Under the hood,nest() andunnest() areimplemented withchop(),pack(),unchop(), andunpack():

Packing and chopping are interesting primarily because they are theatomic operations underlying nesting (and similarly, unchop andunpacking underlie unnesting), and I don’t expect them to be useddirectly very often.

New features

Bug fixes and minorimprovements

tidyr 0.8.3

tidyr 0.8.2

tidyr 0.8.1

tidyr 0.8.0

Breaking changes

New features

Bug fixes and minorimprovements

tidyr 0.7.2

tidyr 0.7.1

This is a hotfix release to account for some tidyselect changes inthe unit tests.

Note that the upcoming version of tidyselect backtracks on some ofthe changes announced for 0.7.0. The special evaluation semantics forselection have been changed back to the old behaviour because the newrules were causing too much trouble and confusion. From now on dataexpressions (symbols and calls to: andc())can refer to both registered variables and to objects from thecontext.

However the semantics for context expressions (any calls other thanto: andc()) remain the same. Thoseexpressions are evaluated in the context only and cannot refer toregistered variables. If you’re writing functions and refer tocontextual objects, it is still a good idea to avoid data expressions byfollowing the advice of the 0.7.0 release notes.

tidyr 0.7.0

This release includes important changes to tidyr internals. Tidyr nowsupports the new tidy evaluation framework for quoting (NSE) functions.It also uses the new tidyselect package as selecting backend.

Breaking changes

Switch to tidy evaluation

tidyr is now a tidy evaluation grammar. See theprogrammingvignette in dplyr for practical information about tidyevaluation.

The tidyr port is a bit special. While the philosophy of tidyevaluation is that R code should refer to real objects (from the dataframe or from the context), we had to make some exceptions to this rulefor tidyr. The reason is that several functions accept bare symbols tospecify the names ofnew columns to create(gather() being a prime example). This is not tidy becausethe symbol do not represent any actual object. Our workaround is tocapture these arguments usingrlang::quo_name() (so theystill support quasiquotation and you can unquote symbols or strings).This type of NSE is now discouraged in the tidyverse: symbols in R codeshould represent real objects.

Following the switch to tidy eval the underscored variants are softlydeprecated. However they will remain around for some time and withoutwarning for backward compatibility.

Switch to the tidyselectbackend

The selecting backend of dplyr has been extracted in a standalonepackage tidyselect which tidyr now uses for selecting variables. It isused for selecting multiple variables (indrop_na()) aswell as single variables (thecol argument ofextract() andseparate(), and thekey andvalue arguments ofspread()). This implies the following changes:

tidyr 0.6.3

tidyr 0.6.2

tidyr 0.6.1

tidyr 0.6.0

API changes

Bug fixes and minorimprovements

tidyr 0.5.1

tidyr 0.5.0

New functions

Bug fixes and minorimprovements

tidyr 0.4.1

tidyr 0.4.0

Nested data frames

nest() andunnest() have been overhauled tosupport a useful way of structuring data frames: thenested data frame. In a grouped data frame, you haveone row per observation, and additional metadata define the groups. In anested data frame, you have onerow per group, and theindividual observations are stored in a column that is a list of dataframes. This is a useful structure when you have lists of other objects(like models) with one element per group.

Expanding

Minor bug fixes andimprovements

tidyr 0.3.1

tidyr 0.3.0

New features

Bug fixes and minorimprovements

tidyr 0.2.0

New functions

Bug fixes and minorimprovements


[8]ページ先頭

©2009-2025 Movatter.jp