Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unnest() on list with factor does not work after upgrading to 0.8.0 #442

Closed
erblast opened this issue Mar 28, 2018 · 3 comments
Closed

unnest() on list with factor does not work after upgrading to 0.8.0 #442

erblast opened this issue Mar 28, 2018 · 3 comments

Comments

@erblast
Copy link

erblast commented Mar 28, 2018

thanks for the great tidyverse packages. I recently ran into a problem after upgrading R to 3.4.4 and subsequently tidyr to 0.8.0 and tibble to 1.4.2. I am posting the issue here because I get the error when trying to use unnest()

this does not work anymore -----------------------------------------------------------------------------

require(tidyr)
require(tibble)

vec_num = c( 1, 2, 3)

vec_fac = as.factor( vec_num )

tib = tibble( v = list( vec_num ) )
unnest( tib, v )

tib = tibble( v = list( vec_fac ) ) 
unnest( tib, v )

sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] tibble_1.4.2 tidyr_0.8.0 

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.16     utf8_1.1.3       crayon_1.3.4     dplyr_0.7.4      assertthat_0.2.0 R6_2.2.2         magrittr_1.5     pillar_1.2.1    
 [9] cli_1.0.0        rlang_0.2.0      rstudioapi_0.7   bindrcpp_0.2     tools_3.4.4      glue_1.2.0       purrr_0.2.4      yaml_2.1.18     
[17] compiler_3.4.4   pkgconfig_2.0.1  bindr_0.1.1      tidyselect_0.2.4

but used to work with this configuration ----------------------------------------------------------------------

R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] forcats_0.2.0      stringr_1.2.0      dplyr_0.7.4        purrr_0.2.4        readr_1.1.1       
[6] tidyr_0.7.2        tibble_1.3.4       ggplot2_2.2.1.9000 tidyverse_1.2.1   

loaded via a namespace (and not attached):
[1] Rcpp_0.12.14      cellranger_1.1.0  compiler_3.4.3    plyr_1.8.4        bindr_0.1         tools_3.4.3      
[7] lubridate_1.7.1   jsonlite_1.5      nlme_3.1-131      gtable_0.2.0      lattice_0.20-35   pkgconfig_2.0.1  
[13] rlang_0.1.4       psych_1.7.8       cli_1.0.0         rstudioapi_0.7    parallel_3.4.3    haven_1.1.0      
[19] bindrcpp_0.2      xml2_1.1.1        httr_1.3.1        hms_0.4.0         grid_3.4.3        glue_1.2.0       
[25] R6_2.2.2          readxl_1.0.0      foreign_0.8-69    modelr_0.1.1      reshape2_1.4.3    magrittr_1.5     
[31] scales_0.5.0.9000 rvest_0.3.2       assertthat_0.2.0  mnormt_1.5-5      colorspace_1.3-2  stringi_1.1.6    
[37] lazyeval_0.2.1    munsell_0.4.3     broom_0.4.3       crayon_1.3.4     
@cderv
Copy link
Contributor

cderv commented Mar 28, 2018

It has been reported in #407 and already been fixed (see NEWS)

It is working on last dev version

library(tidyr)
packageVersion("tidyr")
#> [1] '0.8.0.9000'
library(tibble)
packageVersion("tibble")
#> [1] '1.4.2'

vec_num <- c(1, 2, 3)

vec_fac <- as.factor(vec_num)

tib <- tibble(v = list(vec_num))
unnest(tib, v)
#> # A tibble: 3 x 1
#>       v
#>   <dbl>
#> 1    1.
#> 2    2.
#> 3    3.

tib <- tibble(v = list(vec_fac))
unnest(tib, v)
#> # A tibble: 3 x 1
#>   v    
#>   <fct>
#> 1 1    
#> 2 2    
#> 3 3

Created on 2018-03-28 by the reprex package (v0.2.0).

Session info
devtools::session_info()
#> Session info -------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.4.3 (2017-11-30)
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  French_France.1252          
#>  tz       Europe/Paris                
#>  date     2018-03-28
#> Packages -----------------------------------------------------------------
#>  package     * version    date       source                            
#>  ansistrings   1.0.0.9000 2018-03-28 Github (r-lib/ansistrings@4e4d309)
#>  assertthat    0.2.0      2017-04-11 CRAN (R 3.4.0)                    
#>  backports     1.1.2      2017-12-13 CRAN (R 3.4.3)                    
#>  base        * 3.4.3      2017-12-06 local                             
#>  bindr         0.1.0.9000 2018-02-09 Github (krlmlr/bindr@4b20179)     
#>  bindrcpp      0.2.0.9000 2018-02-10 Github (krlmlr/bindrcpp@7553d4f)  
#>  cli           1.0.0.9002 2018-03-28 Github (r-lib/cli@53c129a)        
#>  compiler      3.4.3      2017-12-06 local                             
#>  crayon        1.3.4      2017-09-16 CRAN (R 3.4.2)                    
#>  datasets    * 3.4.3      2017-12-06 local                             
#>  devtools      1.13.5     2018-02-18 CRAN (R 3.4.3)                    
#>  digest        0.6.15     2018-01-28 CRAN (R 3.4.3)                    
#>  dplyr         0.7.4      2017-09-28 CRAN (R 3.4.3)                    
#>  evaluate      0.10.1     2017-06-24 CRAN (R 3.4.2)                    
#>  glue          1.2.0      2017-10-29 CRAN (R 3.4.2)                    
#>  graphics    * 3.4.3      2017-12-06 local                             
#>  grDevices   * 3.4.3      2017-12-06 local                             
#>  hms           0.4.2      2018-03-10 CRAN (R 3.4.3)                    
#>  htmltools     0.3.6      2017-04-28 CRAN (R 3.4.2)                    
#>  knitr         1.20       2018-02-20 CRAN (R 3.4.3)                    
#>  magrittr      1.5        2014-11-22 CRAN (R 3.4.2)                    
#>  memoise       1.1.0      2017-04-21 CRAN (R 3.4.3)                    
#>  methods     * 3.4.3      2017-12-06 local                             
#>  pillar        1.2.1      2018-02-27 CRAN (R 3.4.3)                    
#>  pkgconfig     2.0.1      2017-03-21 CRAN (R 3.4.0)                    
#>  prettyunits   1.0.2      2015-07-13 CRAN (R 3.4.0)                    
#>  progress      1.1.2.9002 2018-03-28 Github (r-lib/progress@72c9873)   
#>  purrr         0.2.4.9000 2018-02-05 Github (cderv/purrr@249a3e9)      
#>  R6            2.2.2      2017-06-17 CRAN (R 3.4.2)                    
#>  Rcpp          0.12.16    2018-03-13 CRAN (R 3.4.4)                    
#>  rlang         0.2.0.9001 2018-03-28 Github (tidyverse/rlang@49d7a34)  
#>  rmarkdown     1.8.10     2018-02-24 Github (rstudio/rmarkdown@1ccf6a0)
#>  rprojroot     1.3-2      2018-01-03 CRAN (R 3.4.3)                    
#>  selectr       0.3-2      2018-03-05 CRAN (R 3.4.3)                    
#>  stats       * 3.4.3      2017-12-06 local                             
#>  stringi       1.1.7      2018-03-12 CRAN (R 3.4.3)                    
#>  stringr       1.3.0      2018-02-19 CRAN (R 3.4.3)                    
#>  tibble      * 1.4.2      2018-03-28 Github (tidyverse/tibble@5f0b6a0) 
#>  tidyr       * 0.8.0.9000 2018-03-28 Github (tidyverse/tidyr@32b73ea)  
#>  tidyselect    0.2.4      2018-02-26 CRAN (R 3.4.3)                    
#>  tools         3.4.3      2017-12-06 local                             
#>  utf8          1.1.3      2018-01-03 CRAN (R 3.4.3)                    
#>  utils       * 3.4.3      2017-12-06 local                             
#>  withr         2.1.2      2018-03-28 Github (r-lib/withr@79d7b0d)      
#>  xml2          1.1.0      2017-01-07 url                               
#>  yaml          2.1.18     2018-03-08 CRAN (R 3.4.3)

@erblast
Copy link
Author

erblast commented Apr 4, 2018

thanks for letting me know

@batpigandme
Copy link
Contributor

Glad it's fixed! Thanks for tracking this one, @cderv!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants