[R] Aligning ragged text columns

John Wiedenhoeft wiedenhoeft at gmx.net
Wed Jul 19 11:17:14 CEST 2006


Am Mittwoch, den 19.07.2006, 10:03 +0100 schrieb hadley wickham:
> Can anyone please suggest how I can print:
> 
> a <- matrix(c(
> 	"Heading 1",  "This is some info\nabout heading 1",
> 	"Heading 2",  "This is some info\nabout heading 2",
> ), byrow=T, nrow=2)
> 
> to look like:
> 
> Heading 1  This is some info
>            about heading 1
> Heading 2  This is some info
>            about heading 2


Guess its

heading1 <- "Heading1"
heading2 <- "Heading2"

a <- matrix(c(
	"Heading 1",  paste("This is some info\nabout", heading1, sep=""),
	"Heading 2",  paste("This is some info\nabout", heading2, sep=""),
), byrow=T, nrow=2)


Cheers,
John



More information about the R-help mailing list