The goal of tidyr is to help you create tidy data. Tidy data is data where:
Tidy data describes a standard way of storing data that is used wherever possible throughout the tidyverse. If you ensure that your data is tidy, you’ll spend less time fighting with the tools and more time working on your analysis. Learn more about tidy data in
tidyr functions fall into five main categories:
“Pivotting” which converts between long and wide forms. tidyr 1.0.0 introduces
pivot_wider(), replacing the older
gather() functions. See
vignette("pivot") for more details.
Nesting converts grouped data to a form where each group becomes a single row containing a nested data frame, and unnesting does the opposite. See
vignette("nest") for more details.
Splitting and combining character columns. Use
extract() to pull a single character column into multiple columns; use
unite() to combine multiple columns into a single character column.
Make implicit missing values explicit with
complete(); make explicit missing values implicit with
drop_na(); replace missing values with next/previous value with
fill(), or a known value with
Please note that the tidyr project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.