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

vec_c(<empty named>, <empty named>) -> empty unnamed #1263

Closed
romainfrancois opened this issue Sep 17, 2020 · 2 comments · Fixed by #1267
Closed

vec_c(<empty named>, <empty named>) -> empty unnamed #1263

romainfrancois opened this issue Sep 17, 2020 · 2 comments · Fixed by #1267

Comments

@romainfrancois
Copy link
Contributor

I would expect vec_c(x, x) to be named here. I believe this is the cause of tidyverse/dplyr#5523

library(vctrs)
x <- rlang::set_names(integer(), character())
vec_c(x, x)
#> integer(0)
vec_c(x)
#> named integer(0)

Created on 2020-09-17 by the reprex package (v0.3.0.9001)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 4.0.0 (2020-04-24)
#>  os       macOS Catalina 10.15.6      
#>  system   x86_64, darwin17.0          
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       Europe/Paris                
#>  date     2020-09-17                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date       lib source                           
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 4.0.0)                   
#>  backports     1.1.8      2020-06-17 [1] CRAN (R 4.0.0)                   
#>  cli           2.0.2      2020-02-28 [1] CRAN (R 4.0.0)                   
#>  crayon        1.3.4.9000 2020-07-01 [1] Github (r-lib/crayon@dcf6d44)    
#>  digest        0.6.25     2020-02-23 [1] CRAN (R 4.0.0)                   
#>  ellipsis      0.3.1      2020-05-15 [1] CRAN (R 4.0.1)                   
#>  evaluate      0.14       2019-05-28 [1] CRAN (R 4.0.0)                   
#>  fansi         0.4.1      2020-01-08 [1] CRAN (R 4.0.0)                   
#>  fs            1.4.2      2020-06-30 [1] CRAN (R 4.0.0)                   
#>  glue          1.4.1      2020-05-13 [1] CRAN (R 4.0.0)                   
#>  highr         0.8        2019-03-20 [1] CRAN (R 4.0.0)                   
#>  htmltools     0.5.0      2020-06-16 [1] CRAN (R 4.0.0)                   
#>  knitr         1.29       2020-06-23 [1] CRAN (R 4.0.0)                   
#>  lifecycle     0.2.0      2020-03-06 [1] CRAN (R 4.0.0)                   
#>  magrittr      1.5        2014-11-22 [1] CRAN (R 4.0.0)                   
#>  pillar        1.4.6      2020-07-10 [1] CRAN (R 4.0.0)                   
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 4.0.0)                   
#>  purrr         0.3.4      2020-04-17 [1] CRAN (R 4.0.0)                   
#>  reprex        0.3.0.9001 2020-06-19 [1] Github (tidyverse/reprex@d898823)
#>  rlang         0.4.7      2020-07-09 [1] CRAN (R 4.0.0)                   
#>  rmarkdown     2.3        2020-06-18 [1] CRAN (R 4.0.0)                   
#>  rstudioapi    0.11       2020-02-07 [1] CRAN (R 4.0.0)                   
#>  sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 4.0.0)                   
#>  stringi       1.4.6      2020-02-17 [1] CRAN (R 4.0.0)                   
#>  stringr       1.4.0      2019-02-10 [1] CRAN (R 4.0.0)                   
#>  styler        1.3.2      2020-02-23 [1] CRAN (R 4.0.0)                   
#>  tibble        3.0.3      2020-07-10 [1] CRAN (R 4.0.0)                   
#>  vctrs       * 0.3.4.9000 2020-09-17 [1] local                            
#>  withr         2.2.0      2020-04-20 [1] CRAN (R 4.0.0)                   
#>  xfun          0.16       2020-07-24 [1] CRAN (R 4.0.2)                   
#>  yaml          2.2.1      2020-02-01 [1] CRAN (R 4.0.0)                   
#> 
#> [1] /Users/romainfrancois/.R/library/4.0
#> [2] /Library/Frameworks/R.framework/Versions/4.0/Resources/library
@lionel-
Copy link
Member

lionel- commented Sep 17, 2020

Names are not part of the common type so I'm not sure this is the expected behaviour.

@lionel-
Copy link
Member

lionel- commented Sep 17, 2020

Common types don't have names, but as Davis points out this should still be named since we lazily alloc names for the output if any of the inputs are named.

DavisVaughan added a commit to DavisVaughan/vctrs that referenced this issue Sep 17, 2020
DavisVaughan added a commit to DavisVaughan/vctrs that referenced this issue Sep 22, 2020
romainfrancois added a commit to tidyverse/dplyr that referenced this issue Oct 13, 2020
romainfrancois added a commit to tidyverse/dplyr that referenced this issue Oct 14, 2020
* `across()` handles data frames with 0 columns

closes #5523

* additional comment now that r-lib/vctrs#1263 is on dev vctrs
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

Successfully merging a pull request may close this issue.

2 participants