【发布时间】:2019-05-11 13:11:51
【问题描述】:
我将文本 sn-ps 拆分为三列。我想在 R 控制台的KWIC concordance format 中显示这三列,以便快速“视觉分析”。为此,第一列需要右对齐,中间一列居中,第三列左对齐。
这里有一些示例数据来演示这个问题:
concordance1 <- c("Well it's not that easy as you can tell I was trying to work out how this", "is working", "but I can't say I understand yet")
concordance2 <- c("they've just", "been having", "more and more trouble")
concordance3 <- c(" sorry I wasn't really engaging Um I", "was thinking", "back to like youth club days...")
data <- as.data.frame(rbind(concordance1, concordance2, concordance3))
如果我只是打印数据,所有三列都是左对齐的,R 会在几行上显示索引行,所以它完全难以辨认。
data
到目前为止,tibble 显示是我能找到的最好的。它将表格的宽度调整为我的控制台显示(见屏幕截图),这是一个改进。这是一个开始,但为了快速分析这些索引,我需要能够在 tibble 显示中右对齐第一列。
我很感激任何关于如何实现这一目标的提示。谢谢!
【问题讨论】: