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

Lists of language objects #321

Closed
wlandau opened this issue May 6, 2019 · 1 comment
Closed

Lists of language objects #321

wlandau opened this issue May 6, 2019 · 1 comment

Comments

@wlandau
Copy link

wlandau commented May 6, 2019

Summary

What is the best way to create a list of language objects in vctrs?

vctrs::list_of(quote(foo <- 0L))
#> `list(...)[[1]]` must be a vector, not a call
utils::packageDescription("vctrs")$RemoteSha
#> [1] "25d8607960881c74d1d9272eb71580140311c00d"

Created on 2019-05-06 by the reprex package (v0.2.1)

Session info
devtools::session_info()
#> ─ Session info ──────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.5.2 (2018-12-20)
#>  os       Red Hat Enterprise Linux    
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       America/Indiana/Indianapolis
#>  date     2019-05-06                  
#> 
#> ─ Packages ──────────────────────────────────────────────────────────────
#>  package     * version    date       lib source                      
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.5.2)              
#>  backports     1.1.4      2019-04-10 [1] CRAN (R 3.5.2)              
#>  callr         3.2.0      2019-03-15 [1] CRAN (R 3.5.2)              
#>  cli           1.1.0      2019-03-19 [1] CRAN (R 3.5.2)              
#>  crayon        1.3.4      2017-09-16 [2] CRAN (R 3.5.2)              
#>  desc          1.2.0      2018-05-01 [2] CRAN (R 3.5.2)              
#>  devtools      2.0.2      2019-04-08 [1] CRAN (R 3.5.2)              
#>  digest        0.6.18     2018-10-10 [2] CRAN (R 3.5.2)              
#>  evaluate      0.13       2019-02-12 [1] CRAN (R 3.5.2)              
#>  fs            1.2.7      2019-03-19 [1] CRAN (R 3.5.2)              
#>  glue          1.3.1      2019-03-12 [1] CRAN (R 3.5.2)              
#>  highr         0.8        2019-03-20 [1] CRAN (R 3.5.2)              
#>  htmltools     0.3.6      2017-04-28 [2] CRAN (R 3.5.2)              
#>  knitr         1.22       2019-03-08 [1] CRAN (R 3.5.2)              
#>  magrittr      1.5        2014-11-22 [2] CRAN (R 3.5.2)              
#>  memoise       1.1.0      2017-04-21 [2] CRAN (R 3.5.2)              
#>  pkgbuild      1.0.3      2019-03-20 [1] CRAN (R 3.5.2)              
#>  pkgload       1.0.2      2018-10-29 [2] CRAN (R 3.5.2)              
#>  prettyunits   1.0.2      2015-07-13 [2] CRAN (R 3.5.2)              
#>  processx      3.3.0      2019-03-10 [1] CRAN (R 3.5.2)              
#>  ps            1.3.0      2018-12-21 [1] CRAN (R 3.5.2)              
#>  R6            2.4.0      2019-02-14 [1] CRAN (R 3.5.2)              
#>  Rcpp          1.0.1      2019-03-17 [1] CRAN (R 3.5.2)              
#>  remotes       2.0.4      2019-04-10 [1] CRAN (R 3.5.2)              
#>  rlang         0.3.4.9003 2019-05-06 [1] Github (r-lib/rlang@6a232c0)
#>  rmarkdown     1.12       2019-03-14 [1] CRAN (R 3.5.2)              
#>  rprojroot     1.3-2      2018-01-03 [2] CRAN (R 3.5.2)              
#>  sessioninfo   1.1.1      2018-11-05 [2] CRAN (R 3.5.2)              
#>  stringi       1.4.3      2019-03-12 [1] CRAN (R 3.5.2)              
#>  stringr       1.4.0      2019-02-10 [1] CRAN (R 3.5.2)              
#>  testthat      2.1.1      2019-04-23 [1] CRAN (R 3.5.2)              
#>  usethis       1.5.0      2019-04-07 [1] CRAN (R 3.5.2)              
#>  vctrs         0.1.0.9003 2019-05-06 [1] Github (r-lib/vctrs@25d8607)
#>  withr         2.1.2      2018-03-15 [2] CRAN (R 3.5.2)              
#>  xfun          0.6        2019-04-02 [1] CRAN (R 3.5.2)              
#>  yaml          2.2.0      2018-07-25 [2] CRAN (R 3.5.2)              
#>  zeallot       0.1.0      2018-01-28 [1] CRAN (R 3.5.2)              
#> 
#> [1] /home/c240390/.R/library
#> [2] /opt/R/R-3.5.2/lib64/R/library

Motivation

Lists of language objects come into play at ropensci/drake#489 (comment) and r-lib/pillar#34 (comment). drake in particular makes heavy use of tibbles with lists of language objects, and it would be great to have non-hacky pretty printing.

@hadley
Copy link
Member

hadley commented May 6, 2019

list_of() is not designed to support lists of non-vectors. vctrs is about vectors, not non-vectors, so you'll need to use something else.

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

2 participants