Re: [R] printing an arbitrary-length character vector in columns on a page of a pdf report

2018-06-05 Thread Richard M. Heiberger
yes, thank you for catching that slip. On Tue, Jun 5, 2018 at 11:29 PM, Christopher W. Ryan wrote: > Richard-- > > Nice. If I understand your code correctly, in the line > > ddm <- matrix("", (n+2) %/% nc, nc) > > I could instead use > > ddm <- matrix("", (n + nc - 1) %/% nc, nc) > > for

Re: [R] printing an arbitrary-length character vector in columns on a page of a pdf report

2018-06-05 Thread Christopher W. Ryan
Richard-- Nice. If I understand your code correctly, in the line ddm <- matrix("", (n+2) %/% nc, nc) I could instead use ddm <- matrix("", (n + nc - 1) %/% nc, nc) for generalizability, as I may have to increase nc as the list of words grows ever longer. Thanks everyone. Several good

Re: [R] printing an arbitrary-length character vector in columns on a page of a pdf report

2018-06-05 Thread Richard M. Heiberger
I think this is cuter, and it is a hair faster. n <- length(dd) ddm <- matrix("", (n+2) %/% nc, nc) ddm[1:n] <- dd Rich > system.time(for (i in 1:1) { + add <- nc - (length(dd) %% nc) + dd2 <- c(dd, rep("", add)) + ddm <- matrix(dd2, ncol = nc) + }) user system elapsed 0.064 0.100

Re: [R] printing an arbitrary-length character vector in columns on a page of a pdf report

2018-06-05 Thread Berry, Charles
> On Jun 5, 2018, at 9:45 AM, Christopher W Ryan wrote: > > 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, >

[R] printing an arbitrary-length character vector in columns on a page of a pdf report

2018-06-05 Thread Christopher W Ryan
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