Comments (9)
One idea: if every element has the same "type", display that in the header, and then display the dimension in each row.
from pillar.
We now have this in the PR:
pillar::pillar(vctrs::list_of(1:3))
#> <list<int>>
#> 1, 2, 3
Created on 2019-05-03 by the reprex package (v0.2.1)
from pillar.
And this with r-lib/vctrs#317:
pillar::pillar(vctrs::list_of(1:3, 4:100))
#> <list<int>>
#> [3]
#> [97]
Created on 2019-05-03 by the reprex package (v0.2.1)
from pillar.
We should also think about coloring list columns blue or green (#23 (comment)).
from pillar.
For lists of symbols and language objects, it would be awesome to see the expr_text()
of each element instead of <symbol>
or <language>
. One use case is drake::map_plan()
, which accepts a data frame of function arguments.
library(tidyverse)
args <- expand.grid(
data = c("simulated", "robinson_et_al", "smyth_et_al"),
method = c("bayesian", "frequentist"),
stringsAsFactors = FALSE
) %>%
mutate(data = rlang::syms(data)) %>%
as_tibble() %>%
print()
#> # A tibble: 6 x 2
#> data method
#> <list> <chr>
#> 1 <symbol> bayesian
#> 2 <symbol> bayesian
#> 3 <symbol> bayesian
#> 4 <symbol> frequentist
#> 5 <symbol> frequentist
#> 6 <symbol> frequentist
In map_plan()
, characters get quotes and symbols do not. The distinction is extremely useful.
drake::map_plan(args, analyze)
#> # A tibble: 6 x 2
#> target command
#> <chr> <chr>
#> 1 analyze_34dedc26 "analyze(data = simulated, method = \"bayesian\")"
#> 2 analyze_bc3d5587 "analyze(data = robinson_et_al, method = \"bayesian\")"
#> 3 analyze_524f3aca "analyze(data = smyth_et_al, method = \"bayesian\")"
#> 4 analyze_48fb9d8b "analyze(data = simulated, method = \"frequentist\")"
#> 5 analyze_ee37695c "analyze(data = robinson_et_al, method = \"frequentist…
#> 6 analyze_70ba84cd "analyze(data = smyth_et_al, method = \"frequentist\")"
The command
column of a drake
plan can be a list of language objects rather than a character vector, and I may make language objects the default at some point. One minor source of friction is the printing.
plan %>%
mutate(command = purrr::map(command, rlang::parse_expr)) %>%
print()
#> # A tibble: 6 x 2
#> target command
#> <chr> <list>
#> 1 analyze_34dedc26 <language>
#> 2 analyze_bc3d5587 <language>
#> 3 analyze_524f3aca <language>
#> 4 analyze_48fb9d8b <language>
#> 5 analyze_ee37695c <language>
#> 6 analyze_70ba84cd <language>
I do realize that I can customize printing within a column, but I thought I would ask about the default first. I am not aware of a situation in which a column of <language>
indicators is preferred.
from pillar.
What are your current plans for this issue? I do not mean to rush anything, I am just asking because the priority and timing will affect how I solve it could improve the existing solution to ropensci/drake#700.
ropensci/drake#700 (comment) (using ropensci/drake@fa96707) is an example of what I am looking for. Without custom S3 magic, the command
column would print as a <list>
of <language>
s.
from pillar.
I am still having trouble printing tibble
s that contain lists of language objects. Should I open an issue in vctrs
? Is this within scope?
utils::packageDescription("pillar")$RemoteSha
#> [1] "072fe73e660e8a891f1fbe08607eb60a190444f5"
utils::packageDescription("vctrs")$RemoteSha
#> [1] "25d8607960881c74d1d9272eb71580140311c00d"
tibble::tibble(x = list(quote(foo <- 0L)))
#> # A tibble: 1 x 1
#> x
#> <list>
#> 1 <language>
tibble::tibble(x = vctrs::list_of(quote(foo <- 0L)))
#> `list(...)[[1]]` must be a vector, not a call
vctrs::list_of(quote(foo <- 0L))
#> `list(...)[[1]]` must be a vector, not a call
Created on 2019-05-05 by the reprex package (v0.2.1)
from pillar.
Yes please -- we can't do anything here.
from pillar.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.
from pillar.
Related Issues (20)
- Feedback regarding column superscripts HOT 15
- Use of `focus` argument causes an error HOT 2
- Very small numbers print as `Inf.e-324` HOT 6
- Should `*` or `i` be used for footer information? HOT 11
- Truncated list-cols don't seem to get grey coloring HOT 2
- pillar_num and logical vectors cause (potential?) issues
- Installation of pillar 1.9.0 in GitHub actions fails HOT 2
- Should time zones be changing datetime formatting?
- Conditional colouring of values in specific columns HOT 2
- Infinite date-time being printed twice
- Why do `new_pillar_shaft()` and `new_pillar_shaft_simple()` default `min_width` to `width`? HOT 1
- FR: don't print seconds in dttm if there is not enough space
- FR: Add a pillar.max_chars option HOT 1
- Modify tbl_df subclass print in a package HOT 2
- Feature request: Option to print both head and tail of tables? HOT 6
- Use pillar to make column titles red HOT 1
- Guidance colorizing values within a column HOT 2
- The output of `glimpse()` is too wide in RStudio Visual Editor mode HOT 6
- Show colour in `glimpse()` HOT 1
- pillar::num type vector is not properly treated by base::sum (with respect to na.rm=TRUE) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pillar.