Skip to content

tidyr 0.8.0

Choose a tag to compare

@hadley hadley released this 30 Jan 15:44

Breaking changes

  • There are no deliberate breaking changes in this release. However, a number
    of packages are failing with errors related to numbers of elements in columns,
    and row names. It is possible that these are accidental API changes or new
    bugs. If you see such an error in your package, I would sincerely appreciate
    a minimal reprex.

  • separate() now correctly uses -1 to refer to the far right position,
    instead of -2. If you depended on this behaviour, you'll need to switch
    on packageVersion("tidyr") > "0.7.2"

New features

  • Increased test coverage from 84% to 99%.

  • uncount() performs the inverse operation of dplyr::count() (#279)

Bug fixes and minor improvements

  • complete(data) now returns data rather than throwing an error (#390).
    complete() with zero-length completions returns original input (#331).

  • crossing() preserves NAs (#364).

  • expand() with empty input gives empty data frame instead of NULL (#331).

  • expand(), crossing(), and complete() now complete empty factors instead
    of dropping them (#270, #285)

  • extract() has a better error message if regex does not contain the
    expected number of groups (#313).

  • drop_na() no longer drops columns (@jennybryan, #245), and works with
    list-cols (#280). Equivalent of NA in a list column is any empty
    (length 0) data structure.

  • nest() is now faster, especially when a long data frame is collapsed into
    a nested data frame with few rows.

  • nest() on a zero-row data frame works as expected (#320).

  • replace_na() no longer complains if you try and replace missing values in
    variables not present in the data (#356).

  • replace_na() now also works with vectors (#342, @flying-sheep), and
    can replace NULL in list-columns. It throws a better error message if
    you attempt to replace with something other than length 1.

  • separate() now longer checks that ... is empty, allowing methods to make
    use of it. This check was added in tidyr 0.4.0 (2016-02-02) to deprecate
    previous behaviour where ... was passed to strsplit().

  • separate() and extract() now insert columns in correct position when
    drop = TRUE (#394).

  • separate() now works correctly counts from RHS when using negative
    integer sep values (@markdly, #315).

  • separate() gets improved warning message when pieces aren't as expected
    (#375).

  • separate_rows() supports list columns (#321), and works with empty tibbles.

  • spread() now consistently returns 0 row outputs for 0 row inputs (#269).

  • spread() now works when key column includes NA and drop is FALSE
    (#254).

  • spread() no longer returns tibbles with row names (#322).

  • spread(), separate(), extract() (#255), and gather() (#347) now
    replace existing variables rather than creating an invalid data frame with
    duplicated variable names (matching the semantics of mutate).

  • unite() now works (as documented) if you don't supply any variables (#355).

  • unnest() gains preserve argument which allows you to preserve list
    columns without unnesting them (#328).

  • unnest() can unnested list-columns contains lists of lists (#278).

  • unnest(df) now works if df contains no list-cols (#344)