You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like the way we defined this method is actually the cause of this issue r-lib/bench#94
i.e. if you have a very long bench expression then it won't get truncated like a normal character column would. It seems like this is because min_width defaults to width, disallowing any truncation.
i.e. convert to character and then use the standard pillar_shaft.character() method.
The pillar_shaft.character() method respects pillar.min_chars through get_pillar_option_min_chars() so the min_width ends up being a good default of 3 by doing this.
I wonder if the default of new_pillar_shaft() and new_pillar_shaft_simple() should also respect this option rather than defaulting to width?
The text was updated successfully, but these errors were encountered:
Maybe width is a good default for most types (because, for example, you want to see the full number with a double column), and character vectors are just a bit special?
In that case, my solution above is pretty similar to what is done for factors, so I feel pretty good about it
Thanks. The solution applied in bench looks good to me. With rlang::expr_deparse(width = ...), you could perhaps truncate in a nicer way (if not done already).
In bench, there is a custom expression class called
bench_expr
that displays the captured expressionsWe have a
pillar_shaft()
method for this that looks like:It seems like the way we defined this method is actually the cause of this issue
r-lib/bench#94
i.e. if you have a very long bench expression then it won't get truncated like a normal character column would. It seems like this is because
min_width
defaults towidth
, disallowing any truncation.It seems like I can fix it by doing this:
i.e. convert to character and then use the standard
pillar_shaft.character()
method.The
pillar_shaft.character()
method respectspillar.min_chars
throughget_pillar_option_min_chars()
so themin_width
ends up being a good default of3
by doing this.I wonder if the default of
new_pillar_shaft()
andnew_pillar_shaft_simple()
should also respect this option rather than defaulting towidth
?The text was updated successfully, but these errors were encountered: