Movatterモバイル変換


[0]ホーム

URL:


tidyrtidyr website

CRAN statusR-CMD-checkCodecov test coverage

Overview

The goal of tidyr is to help you createtidy data.Tidy data is data where:

  1. Each variable is a column; each column is a variable.
  2. Each observation is a row; each row is an observation.
  3. Each value is a cell; each cell is a single value.

Tidy data describes a standard way of storing data that is usedwherever possible throughout thetidyverse. If you ensure that yourdata is tidy, you’ll spend less time fighting with the tools and moretime working on your analysis. Learn more about tidy data invignette("tidy-data").

Installation

# The easiest way to get tidyr is to install the whole tidyverse:install.packages("tidyverse")# Alternatively, install just tidyr:install.packages("tidyr")# Or the development version from GitHub:# install.packages("pak")pak::pak("tidyverse/tidyr")

Cheatsheet

Getting started

library(tidyr)

tidyr functions fall into five main categories:

Related work

tidyrsupersedesreshape2 (2010-2014) and reshape (2005-2010). Somewhatcounterintuitively, each iteration of the package has done less. tidyris designed specifically for tidying data, not general reshaping(reshape2), or the general aggregation (reshape).

data.tableprovides high-performance implementations ofmelt() anddcast()

If you’d like to read more about data reshaping from a CSperspective, I’d recommend the following three papers:

To guide your reading, here’s a translation between the terminologyused in different places:

tidyr 1.0.0pivot longerpivot wider
tidyr < 1.0.0gatherspread
reshape(2)meltcast
spreadsheetsunpivotpivot
databasesfoldunfold

Getting help

If you encounter a clear bug, please file a minimal reproducibleexample ongithub. Forquestions and other discussion, please usecommunity.rstudio.com.


Please note that the tidyr project is released with aContributor Codeof Conduct. By contributing to this project, you agree to abide byits terms.


[8]ページ先頭

©2009-2025 Movatter.jp