tidyr::nest() needs to learn about dplyr 0.8.0

Created on 20 Feb 2019  路  3Comments  路  Source: tidyverse/tidyr

As explained in https://github.com/cienciadedatos/r4ds/issues/68 and the references therein, installing the current tidyverse version from CRAN on a fresh R setup (i.e. building to gh-pages via Travis CI or just new laptop) breaks the code from the examples exposed in model-many.Rmd from R4DS

The issue that I make reference to is from the spanish R4DS translation and its causes were very tricky to detect.

Most helpful comment

馃敟馃

All 3 comments

It looks like it's related to dplyr 0.8.0.

devtools::install_github("pachamaltese/datos")

library("datos")
library("tidyverse")

por_pais <- paises %>%
  group_by(pais, continente) %>%
  nest()

# With 0.7.8
sum(map_lgl(por_pais$data, is.null))
#> [1] 0

# With 0.8.0
sum(map_lgl(por_pais$data, is.null))
#> [1] 113

I believe this is related to this tidyr PR. https://github.com/tidyverse/tidyr/pull/511

In the PR, tidyr::nest() uses the new group_nest(), and would give e.g.:

library("datos")
library("tidyverse")
#> Warning: package 'tibble' was built under R version 3.5.2

por_pais <- paises %>%
  group_by(pais, continente) %>%
  group_nest()

# With 0.8.0
sum(map_lgl(por_pais$data, is.null))
#> [1] 0

Created on 2019-02-20 by the reprex package (v0.2.1.9000)

馃敟馃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moodymudskipper picture moodymudskipper  路  5Comments

earowang picture earowang  路  9Comments

thays42 picture thays42  路  3Comments

albertotb picture albertotb  路  7Comments

andrewpbray picture andrewpbray  路  8Comments