tidyr 0.2.0 (and reshape2 1.4.1)

RStudio Blog

tidyr 0.2.0 is now available on CRAN. tidyr makes it easy to “tidy” your data, storing it in a consistent form so that it’s easy to manipulate, visualise and model. Tidy data has variables in columns and observations in rows, and is described in more detail in the tidy data vignette. Install tidyr with:


There are three important additions to tidyr 0.2.0:

  • expand() is a wrapper around expand.grid() that allows you to generate all possible combinations of two or more variables. In conjunction with dplyr::left_join(), this makes it easy to fill in missing rows of data.
    sales <- dplyr::data_frame( year = rep(c(2012, 2013), c(4, 2)), quarter = c(1, 2, 3, 4, 2, 3), sales = sample(6) * 100 ) # Missing sales data for 2013 Q1 & Q4 sales #> Source: local data frame [6 x 3] #> #> year quarter sales #> 1 2012 1 400 #>…

View original post 480 more words

About rugbcn

R User Gruop Barcelona

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: