问题描述
使用最新版本的tibble
设置width = Inf
时,不能正确显示宽tibble 的输出.
Using the latest version of tibble
the output of wide tibbles is not properly displayed when setting width = Inf
.
根据我对以前版本的测试,直到 1.3.0 之后的版本都可以很好地打印宽小标题.这就是我希望输出的打印方式:
Based on my tests with previous versions wide tibbles were printed nicely until versions later than 1.3.0. This is what I would like the output to be printed like:
...但这是使用最新版本的 tibble 的样子:
...but this is what it looks like using the latest version of tibble:
我对旧资料进行了修补,但无济于事.我想将它合并到一个包中,以便解决方案应该通过 R CMD 检查.当我刚刚从 tibble
v1.3.0 复制了一堆函数时,我设法恢复了旧的行为,但无法通过检查.
I tinkered around with the old sources but to no avail. I would like to incorporate this in a package so the solution should pass R CMD check. When I just copied a load of functions from tibble
v1.3.0 I managed to restore the old behavior but could not pass the check.
Github 上有一个开放的 issue 与此问题相关,但显然不高"优先事项'.有没有办法用新版本正确打印小标题?
There's an open issue on Github related to this problem but it's apparently 'not high priority'. Is there a way to print tibbles properly with the new version?
推荐答案
试试这个功能:
print_width_inf <- function(df, n = 6) {
df %>%
head(n = n) %>%
as.data.frame() %>%
tibble:::shrink_mat(width = Inf, rows = NA, n = n, star = FALSE) %>%
`[[`("table") %>%
print()
}
这篇关于在 v1.3.0 中打印带有分栏符的 tibble的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!