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

pack() error related to defunct NULL environment #48

Closed
rtaph opened this issue Jun 14, 2021 · 8 comments
Closed

pack() error related to defunct NULL environment #48

rtaph opened this issue Jun 14, 2021 · 8 comments

Comments

@rtaph
Copy link

rtaph commented Jun 14, 2021

Hello,

Thank you for such a useful package!

I stumbled across the below error while re-running some code that previously ran without a hitch. Digging into it further, I tracked it down to the pack() function misbehaving.

Running the documentation example no longer works for me:

library(unpivotr)
w <- data.frame(foo = 1:2,
                bar = c("a", "b"),
                stringsAsFactors = FALSE)
x <- as_cells(w)

pack(x)
#> Error in (function (arg) : use of NULL environment is defunct

Created on 2021-06-13 by the reprex package (v2.0.0)

I am guessing perhaps it has to do with a change in rlang or purrr? In any event, switching from a formula to an anonymous function in the map() fixed the issue for me.

Has anyone else come across this?

Session Info

─ Session info ────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.1.0 (2021-05-18)
os macOS Big Sur 11.3.1
system x86_64, darwin17.0
ui RStudio
language (EN)
collate en_CA.UTF-8
ctype en_CA.UTF-8
tz America/Vancouver
date 2021-06-13

─ Packages ────────────────────────────────────────────────────────────────────────────────────
! package * version date lib source
P backports 1.2.1 2020-12-09 [?] CRAN (R 4.1.0)
P callr 3.7.0 2021-04-20 [?] CRAN (R 4.1.0)
P cli 2.5.0 2021-04-26 [?] CRAN (R 4.1.0)
P clipr 0.7.1 2020-10-08 [?] CRAN (R 4.1.0)
P crayon 1.4.1 2021-02-08 [?] CRAN (R 4.1.0)
P digest 0.6.27 2020-10-24 [?] CRAN (R 4.1.0)
P ellipsis 0.3.2 2021-04-29 [?] CRAN (R 4.1.0)
P evaluate 0.14 2019-05-28 [?] CRAN (R 4.1.0)
P fansi 0.5.0 2021-05-25 [?] CRAN (R 4.1.0)
P fs 1.5.0 2020-07-31 [?] CRAN (R 4.1.0)
P glue 1.4.2 2020-08-27 [?] CRAN (R 4.1.0)
P highr 0.9 2021-04-16 [?] CRAN (R 4.1.0)
P htmltools 0.5.1.1 2021-01-22 [?] CRAN (R 4.1.0)
P knitr 1.33 2021-04-24 [?] CRAN (R 4.1.0)
P lifecycle 1.0.0 2021-02-15 [?] CRAN (R 4.1.0)
P magrittr 2.0.1 2020-11-17 [?] CRAN (R 4.1.0)
P pillar 1.6.1 2021-05-16 [?] CRAN (R 4.1.0)
P pkgconfig 2.0.3 2019-09-22 [?] CRAN (R 4.1.0)
P processx 3.5.2 2021-04-30 [?] CRAN (R 4.1.0)
P ps 1.6.0 2021-02-28 [?] CRAN (R 4.1.0)
purrr 0.3.4.9000 2021-06-14 [1] Github (tidyverse/purrr@5aca9df)
P R6 2.5.0 2020-10-28 [?] CRAN (R 4.1.0)
renv 0.13.2 2021-03-30 [1] CRAN (R 4.1.0)
P reprex 2.0.0 2021-04-02 [?] CRAN (R 4.1.0)
rlang 0.4.11.9000 2021-06-14 [1] Github (r-lib/rlang@b501cf7)
P rmarkdown 2.8 2021-05-07 [?] CRAN (R 4.1.0)
P rstudioapi 0.13 2020-11-12 [?] CRAN (R 4.1.0)
P sessioninfo 1.1.1 2018-11-05 [?] CRAN (R 4.1.0)
P styler 1.4.1 2021-03-30 [?] CRAN (R 4.1.0)
tibble 3.1.2.9000 2021-06-07 [1] Github (tidyverse/tibble@e78b695)
P utf8 1.2.1 2021-03-12 [?] CRAN (R 4.1.0)
vctrs 0.3.8.9000 2021-06-14 [1] Github (r-lib/vctrs@faccc3a)
P withr 2.4.2 2021-04-18 [?] CRAN (R 4.1.0)
P xfun 0.23 2021-05-15 [?] CRAN (R 4.1.0)
P yaml 2.2.1 2020-02-01 [?] CRAN (R 4.1.0)

[1] /Users/raf/r/rena/renv/library/R-4.1/x86_64-apple-darwin17.0
[2] /private/var/folders/0y/w_jlxwxs0l51cs1m43crzvnw0000gn/T/Rtmp4lkECQ/renv-system-library

P ── Loaded and on-disk path mismatch.

@michael-dewar
Copy link

I tried to start the book Spreadsheet Munging Strategies but got a similar error right away. The following errors:

path <- system.file("extdata", "worked-examples.xlsx", package = "unpivotr")
xlsx_cells(path, sheet = "clean") %>%
	behead("up", header) 

@nacnudus
Copy link
Owner

Thank you both for reporting this problem. However, I can't reproduce it with the latest CRAN versions of all packages. Are you able to update the packages you use (e.g. with remotes::update_packages() and try again?

Session Info
─ Session info ───────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.1.0 (2021-05-18)
 os       Arch Linux                  
 system   x86_64, linux-gnu           
 ui       X11                         
 language (EN)                        
 collate  en_GB.UTF-8                 
 ctype    en_GB.UTF-8                 
 tz       Europe/London               
 date     2021-06-28                  

─ Packages ───────────────────────────────────────────────────────────────────
 package     * version date       lib source        
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.1.0)
 cachem        1.0.5   2021-05-15 [1] CRAN (R 4.1.0)
 callr         3.7.0   2021-04-20 [1] CRAN (R 4.1.0)
 cli           2.5.0   2021-04-26 [1] CRAN (R 4.1.0)
 crayon        1.4.1   2021-02-08 [1] CRAN (R 4.1.0)
 DBI           1.1.1   2021-01-15 [1] CRAN (R 4.1.0)
 desc          1.3.0   2021-03-05 [1] CRAN (R 4.1.0)
 devtools      2.4.2   2021-06-07 [1] CRAN (R 4.1.0)
 dplyr         1.0.7   2021-06-18 [1] CRAN (R 4.1.0)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.1.0)
 fansi         0.5.0   2021-05-25 [1] CRAN (R 4.1.0)
 fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.1.0)
 fs            1.5.0   2020-07-31 [1] CRAN (R 4.1.0)
 generics      0.1.0   2020-10-31 [1] CRAN (R 4.1.0)
 glue          1.4.2   2020-08-27 [1] CRAN (R 4.1.0)
 lifecycle     1.0.0   2021-02-15 [1] CRAN (R 4.1.0)
 magrittr      2.0.1   2020-11-17 [1] CRAN (R 4.1.0)
 memoise       2.0.0   2021-01-26 [1] CRAN (R 4.1.0)
 pillar        1.6.1   2021-05-16 [1] CRAN (R 4.1.0)
 pkgbuild      1.2.0   2020-12-15 [1] CRAN (R 4.1.0)
 pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.1.0)
 pkgload       1.2.1   2021-04-06 [1] CRAN (R 4.1.0)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.1.0)
 processx      3.5.2   2021-04-30 [1] CRAN (R 4.1.0)
 ps            1.6.0   2021-02-28 [1] CRAN (R 4.1.0)
 purrr         0.3.4   2020-04-17 [1] CRAN (R 4.1.0)
 R6            2.5.0   2020-10-28 [1] CRAN (R 4.1.0)
 Rcpp          1.0.6   2021-01-15 [1] CRAN (R 4.1.0)
 remotes       2.4.0   2021-06-02 [1] CRAN (R 4.1.0)
 rlang         0.4.11  2021-04-30 [1] CRAN (R 4.1.0)
 rprojroot     2.0.2   2020-11-15 [1] CRAN (R 4.1.0)
 rstudioapi    0.13    2020-11-12 [1] CRAN (R 4.1.0)
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.1.0)
 testthat      3.0.3   2021-06-16 [1] CRAN (R 4.1.0)
 tibble        3.1.2   2021-05-16 [1] CRAN (R 4.1.0)
 tidyselect    1.1.1   2021-04-30 [1] CRAN (R 4.1.0)
 tidyxl      * 1.0.7   2020-11-16 [1] CRAN (R 4.1.0)
 unpivotr    * 0.6.1   2020-08-03 [1] CRAN (R 4.1.0)
 usethis       2.0.1   2021-02-10 [1] CRAN (R 4.1.0)
 utf8          1.2.1   2021-03-12 [1] CRAN (R 4.1.0)
 vctrs         0.3.8   2021-04-29 [1] CRAN (R 4.1.0)
 withr         2.4.2   2021-04-18 [1] CRAN (R 4.1.0)

[1] /home/nacnudus/R/x86_64-pc-linux-gnu-library/4.1
[2] /usr/lib/R/library

@rtaph
Copy link
Author

rtaph commented Jun 28, 2021

When I use CRAN-only installs (via remotes::update_packages()), the example above works without a hitch.

When I subsequently install the development version of rlang, it trips up:

library(unpivotr)
w <- data.frame(foo = 1:2,
                bar = c("a", "b"),
                stringsAsFactors = FALSE)
x <- as_cells(w)

pack(x)
#> Error in (function (arg) : use of NULL environment is defunct

Created on 2021-06-28 by the reprex package (v2.0.0)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 4.1.0 (2021-05-18)
#>  os       macOS Big Sur 10.16         
#>  system   x86_64, darwin17.0          
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_CA.UTF-8                 
#>  ctype    en_CA.UTF-8                 
#>  tz       America/Vancouver           
#>  date     2021-06-28                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version     date       lib source                      
#>  assertthat    0.2.1       2019-03-21 [1] CRAN (R 4.1.0)              
#>  cli           2.5.0       2021-04-26 [1] CRAN (R 4.1.0)              
#>  crayon        1.4.1       2021-02-08 [1] CRAN (R 4.1.0)              
#>  DBI           1.1.1       2021-01-15 [1] CRAN (R 4.1.0)              
#>  digest        0.6.27      2020-10-24 [1] CRAN (R 4.1.0)              
#>  dplyr         1.0.7       2021-06-18 [1] CRAN (R 4.1.0)              
#>  ellipsis      0.3.2       2021-04-29 [1] CRAN (R 4.1.0)              
#>  evaluate      0.14        2019-05-28 [1] CRAN (R 4.1.0)              
#>  fansi         0.5.0       2021-05-25 [1] CRAN (R 4.1.0)              
#>  fs            1.5.0       2020-07-31 [1] CRAN (R 4.1.0)              
#>  generics      0.1.0       2020-10-31 [1] CRAN (R 4.1.0)              
#>  glue          1.4.2       2020-08-27 [1] CRAN (R 4.1.0)              
#>  highr         0.9         2021-04-16 [1] CRAN (R 4.1.0)              
#>  htmltools     0.5.1.1     2021-01-22 [1] CRAN (R 4.1.0)              
#>  knitr         1.33        2021-04-24 [1] CRAN (R 4.1.0)              
#>  lifecycle     1.0.0       2021-02-15 [1] CRAN (R 4.1.0)              
#>  magrittr      2.0.1       2020-11-17 [1] CRAN (R 4.1.0)              
#>  pillar        1.6.1       2021-05-16 [1] CRAN (R 4.1.0)              
#>  pkgconfig     2.0.3       2019-09-22 [1] CRAN (R 4.1.0)              
#>  purrr         0.3.4       2020-04-17 [1] CRAN (R 4.1.0)              
#>  R6            2.5.0       2020-10-28 [1] CRAN (R 4.1.0)              
#>  reprex        2.0.0       2021-04-02 [1] CRAN (R 4.1.0)              
#>  rlang         0.4.11.9000 2021-06-28 [1] Github (r-lib/rlang@869f00a)
#>  rmarkdown     2.9         2021-06-15 [1] CRAN (R 4.1.0)              
#>  rstudioapi    0.13        2020-11-12 [1] CRAN (R 4.1.0)              
#>  sessioninfo   1.1.1       2018-11-05 [1] CRAN (R 4.1.0)              
#>  stringi       1.6.2       2021-05-17 [1] CRAN (R 4.1.0)              
#>  stringr       1.4.0       2019-02-10 [1] CRAN (R 4.1.0)              
#>  tibble        3.1.2       2021-05-16 [1] CRAN (R 4.1.0)              
#>  tidyr         1.1.3       2021-03-03 [1] CRAN (R 4.1.0)              
#>  tidyselect    1.1.1       2021-04-30 [1] CRAN (R 4.1.0)              
#>  unpivotr    * 0.6.1       2020-08-03 [1] CRAN (R 4.1.0)              
#>  utf8          1.2.1       2021-03-12 [1] CRAN (R 4.1.0)              
#>  vctrs         0.3.8       2021-04-29 [1] CRAN (R 4.1.0)              
#>  withr         2.4.2       2021-04-18 [1] CRAN (R 4.1.0)              
#>  xfun          0.24        2021-06-15 [1] CRAN (R 4.1.0)              
#>  yaml          2.2.1       2020-02-01 [1] CRAN (R 4.1.0)              
#> 
#> [1] /Library/Frameworks/R.framework/Versions/4.1/Resources/library

@rtaph
Copy link
Author

rtaph commented Jun 28, 2021

Seems related: r-lib/rlang#1208

@michael-dewar
Copy link

michael-dewar commented Jun 29, 2021

After I reverted rlang to the CRAN version, the error went away. Then I re-installed the development version using remotes::install_github("r-lib/rlang") and the error returned.

Session info
─ Session info ────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.0.5 (2021-03-31)
 os       macOS Big Sur 11.4          
 system   x86_64, darwin17.0          
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/Toronto             
 date     2021-06-29                  

─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version     date       lib source                            
 assertthat    0.2.1       2019-03-21 [1] CRAN (R 4.0.2)                    
 backports     1.2.1       2020-12-09 [1] CRAN (R 4.0.2)                    
 broom         0.7.6       2021-04-05 [1] CRAN (R 4.0.5)                    
 cachem        1.0.5       2021-05-15 [1] CRAN (R 4.0.2)                    
 callr         3.7.0       2021-04-20 [1] CRAN (R 4.0.2)                    
 cellranger    1.1.0       2016-07-27 [1] CRAN (R 4.0.2)                    
 cli           2.5.0       2021-04-26 [1] CRAN (R 4.0.2)                    
 clipr         0.7.1       2020-10-08 [1] CRAN (R 4.0.2)                    
 colorspace    2.0-2       2021-06-24 [1] CRAN (R 4.0.2)                    
 crayon        1.4.1       2021-02-08 [1] CRAN (R 4.0.3)                    
 DBI           1.1.1       2021-01-15 [1] CRAN (R 4.0.2)                    
 dbplyr        2.1.1       2021-04-06 [1] CRAN (R 4.0.5)                    
 desc          1.3.0       2021-03-05 [1] CRAN (R 4.0.2)                    
 devtools    * 2.4.1       2021-05-05 [1] CRAN (R 4.0.2)                    
 dplyr       * 1.0.7       2021-06-18 [1] CRAN (R 4.0.2)                    
 ellipsis      0.3.2       2021-04-29 [1] CRAN (R 4.0.2)                    
 fansi         0.5.0       2021-05-25 [1] CRAN (R 4.0.2)                    
 fastmap       1.1.0       2021-01-25 [1] CRAN (R 4.0.2)                    
 forcats     * 0.5.1       2021-01-27 [1] CRAN (R 4.0.2)                    
 fs            1.5.0       2020-07-31 [1] CRAN (R 4.0.2)                    
 generics      0.1.0       2020-10-31 [1] CRAN (R 4.0.2)                    
 ggplot2     * 3.3.5       2021-06-25 [1] CRAN (R 4.0.2)                    
 glue          1.4.2       2020-08-27 [1] CRAN (R 4.0.2)                    
 gtable        0.3.0       2019-03-25 [1] CRAN (R 4.0.2)                    
 haven         2.4.1       2021-04-23 [1] CRAN (R 4.0.2)                    
 hms           1.1.0       2021-05-17 [1] CRAN (R 4.0.2)                    
 httr          1.4.2       2020-07-20 [1] CRAN (R 4.0.2)                    
 jsonlite      1.7.2       2020-12-09 [1] CRAN (R 4.0.2)                    
 lifecycle     1.0.0       2021-02-15 [1] CRAN (R 4.0.3)                    
 lubridate     1.7.10      2021-02-26 [1] CRAN (R 4.0.3)                    
 magrittr      2.0.1       2020-11-17 [1] CRAN (R 4.0.3)                    
 memoise       2.0.0       2021-01-26 [1] CRAN (R 4.0.2)                    
 modelr        0.1.8       2020-05-19 [1] CRAN (R 4.0.2)                    
 munsell       0.5.0       2018-06-12 [1] CRAN (R 4.0.2)                    
 pillar        1.6.1       2021-05-16 [1] CRAN (R 4.0.2)                    
 pkgbuild      1.2.0       2020-12-15 [1] CRAN (R 4.0.2)                    
 pkgconfig     2.0.3       2019-09-22 [1] CRAN (R 4.0.2)                    
 pkgload       1.2.1       2021-04-06 [1] CRAN (R 4.0.5)                    
 prettyunits   1.1.1       2020-01-24 [1] CRAN (R 4.0.2)                    
 processx      3.5.2       2021-04-30 [1] CRAN (R 4.0.2)                    
 ps            1.6.0       2021-02-28 [1] CRAN (R 4.0.2)                    
 purrr       * 0.3.4       2020-04-17 [1] CRAN (R 4.0.2)                    
 R6            2.5.0       2020-10-28 [1] CRAN (R 4.0.2)                    
 Rcpp          1.0.6       2021-01-15 [1] CRAN (R 4.0.2)                    
 readr       * 1.4.0       2020-10-05 [1] CRAN (R 4.0.2)                    
 readxl      * 1.3.1       2019-03-13 [1] CRAN (R 4.0.2)                    
 remotes       2.3.0       2021-04-01 [1] CRAN (R 4.0.2)                    
 reprex        2.0.0       2021-04-02 [1] CRAN (R 4.0.2)                    
 rlang         0.4.11.9000 2021-06-29 [1] Github (r-lib/rlang@869f00a)      
 rprojroot     2.0.2       2020-11-15 [1] CRAN (R 4.0.2)                    
 rstudioapi    0.13        2020-11-12 [1] CRAN (R 4.0.2)                    
 rvest         1.0.0       2021-03-09 [1] CRAN (R 4.0.2)                    
 scales        1.1.1       2020-05-11 [1] CRAN (R 4.0.2)                    
 sessioninfo   1.1.1       2018-11-05 [1] CRAN (R 4.0.2)                    
 smungs      * 0.0.0.9000  2021-06-28 [1] Github (nacnudus/smungs@1c9fdae)  
 stringi       1.6.2       2021-05-17 [1] CRAN (R 4.0.2)                    
 stringr     * 1.4.0       2019-02-10 [1] CRAN (R 4.0.2)                    
 testthat    * 3.0.2       2021-02-14 [1] CRAN (R 4.0.2)                    
 tibble      * 3.1.2       2021-05-16 [1] CRAN (R 4.0.2)                    
 tidyr       * 1.1.3       2021-03-03 [1] CRAN (R 4.0.2)                    
 tidyselect    1.1.1       2021-04-30 [1] CRAN (R 4.0.2)                    
 tidyverse   * 1.3.1       2021-04-15 [1] CRAN (R 4.0.2)                    
 tidyxl      * 1.0.7.9000  2021-06-28 [1] Github (nacnudus/tidyxl@c078d7a)  
 unpivotr    * 0.6.1       2021-06-28 [1] Github (nacnudus/unpivotr@35c4590)
 usethis     * 2.0.1       2021-02-10 [1] CRAN (R 4.0.2)                    
 utf8          1.2.1       2021-03-12 [1] CRAN (R 4.0.2)                    
 vctrs         0.3.8       2021-04-29 [1] CRAN (R 4.0.2)                    
 withr         2.4.2       2021-04-18 [1] CRAN (R 4.0.2)                    
 xml2          1.3.2       2020-04-23 [1] CRAN (R 4.0.2)                    

[1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library

@nacnudus
Copy link
Owner

Hopefully #49 has fixed this. To check, you will have to reinstall with remotes::install_github("nacnudus/unpivotr").

@rtaph
Copy link
Author

rtaph commented Jun 29, 2021

The development version of unpivotr now works on my end. Thanks for the fix!

@michael-dewar
Copy link

It works for me too. Thanks!

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