I'm writing code for a recurring report, using an R --> Sweave --> pdflatex
workflow. It includes a character vector of short words that I would like
to display compactly, in columns on a page, rather than one word per line,
which would waste a lot of space. The vector of words will increase
unpredictably over time, with future versions of the report.

I thought I would go about it by turning the character vector into a
matrix, as follows:

dd <- LETTERS
## set number of columns. Three for now
nc <- 3
## have to pad the character vector to a length that is multiple of nc
add <- nc - (length(dd) %% nc)
dd2 <- c(dd, rep("", add))
ddm <- matrix(dd2, ncol = nc)
library(Hmisc)
latex(ddm, file = "")

Any ideas for a more elegant way to do this?

Thanks.

--Chris Ryan
Binghamton University
and
Broome County Health Department
Binghamton, NY, US

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to