【发布时间】:2019-02-26 21:34:24
【问题描述】:
我有一个数据框,其中包含可能很长的调查问题的描述。我试图找出一种方法来整齐地打印它们。这是一个例子:
foo <- data.frame(v1 = 1:5,
v2 = rep(c("This is a really long description of a survey question that gives a bunch of information about the question and can be very long blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah"), 5),
v3 = 6:10)
我希望打印输出看起来像这样:
v1 v2 v3
1 1 This is a really long description of 6
a survey question that gives a bunch
of information about the question and
can be very long blah blah blah blah
blah blah blah blah blah blah blah
blah blah blah blah blah blah blah
2 2 This is a really long description of 7
a survey question that gives a bunch
of information about the question and
can be very long blah blah blah blah
blah blah blah blah blah blah blah
blah blah blah blah blah blah blah
3 3 This is a really long description of 8
a survey question that gives a bunch
of information about the question and
can be very long blah blah blah blah
blah blah blah blah blah blah blah
blah blah blah blah blah blah blah
4 4 This is a really long description of 9
a survey question that gives a bunch
of information about the question and
can be very long blah blah blah blah
blah blah blah blah blah blah blah
blah blah blah blah blah blah blah
5 5 This is a really long description of 10
a survey question that gives a bunch
of information about the question and
can be very long blah blah blah blah
blah blah blah blah blah blah blah
blah blah blah blah blah blah blah
【问题讨论】:
-
我还没有遇到在控制台本身中以这种方式打印的方法。但是有几种方法可以将 HTML 表格输出到执行此操作的查看器,例如
flextable::flextable(foo)