Hello,

Is there a way to set the maximum width of character columns when printing a data frame?

I've looked into print(), format(), and options() and have been unsuccessful.

For example, I'd like to achieve the results below without having to modify the data itself.



> x <- data.frame(c1=rnorm(5), c2="ABCDEFGHIJKLMNOPQRSTUVWXYZ")
> x
c1                         c2
1  0.7076495 ABCDEFGHIJKLMNOPQRSTUVWXYZ
2 -0.1572245 ABCDEFGHIJKLMNOPQRSTUVWXYZ
3  0.3515308 ABCDEFGHIJKLMNOPQRSTUVWXYZ
4  0.3492925 ABCDEFGHIJKLMNOPQRSTUVWXYZ
5 -0.3805869 ABCDEFGHIJKLMNOPQRSTUVWXYZ

> x$c2 <- substr(x$c2, 1, 10) #Only show first 10 chars.
> x
c1         c2
1  0.7076495 ABCDEFGHIJ
2 -0.1572245 ABCDEFGHIJ
3  0.3515308 ABCDEFGHIJ
4  0.3492925 ABCDEFGHIJ
5 -0.3805869 ABCDEFGHIJ
Thanks,
Mauricio
	[[alternative HTML version deleted]]

