1
我試圖調整R打印數據幀到控制檯的方式。具體來說,我想打印一個數據框,以便在達到一定寬度後,列的文本將進行換行。理想情況下,我想要的東西,看起來像下面這樣:如何在打印到控制檯時在R中的列中包裝文本?
v1 v2 v3
1 TRUE Some text TRUE
2 TRUE Some more text FALSE
3 TRUE This text wraps FALSE
after a certain
width
4 FALSE Even more text FALSE
5 TRUE More text TRUE
這裏有一個MWE:
data.frame(v1 = c(TRUE, TRUE, TRUE, FALSE, TRUE), v2 = c("Some text", "Some more text", "This text wraps after a certain width", "Even more text", "More text"), y = c(TRUE, FALSE, FALSE, FALSE, TRUE))
options(width=10)
這裏就是我在: