格式化数据框上的格式(...,justify =“left”)是否也左对齐列名称?

时间:2015-03-08 06:52:33

标签: r format dataframe justify output-formatting

我对R来说比较新,所以希望这是一个简单的解决方案。

这是我的问题:

x <- data.frame(c("Thing1", "Thing2", "Thing3", "Thing4", "Thing5"), c("Sizeable line of text", "more text", "I hope this aligns", "something", "help me"))
colnames(x) <- c("T", "Text")
format(x, justify = "left")

       T                  Text
1 Thing1 Sizeable line of text
2 Thing2 more text            
3 Thing3 I hope this aligns   
4 Thing4 not much             
5 Thing5 help me 

如何让列名与数据帧的其余部分左对齐?

提前致谢。

1 个答案:

答案 0 :(得分:2)

# print object explicitly
print(x,right=F)