[R] odfWeave: Error in matrixPaste(...)

Max Kuhn mxkuhn at gmail.com
Wed Jan 14 03:31:46 CET 2009


> Hello all,
> I try the follow test with an odf file.
>
> *INPUT: teste.odt*
> <teste, results=xml>>=
> x <- matrix(rnorm(6), nc=2)
> xst <- tableStyles(x, useRowNames = TRUE, header = NULL)
> odfTable(x, styles=xst,  colnames = NULL, useRowNames = TRUE)
> @

Here is one issue: you are asking for the row names to be styled and
printed but your matrix has no row names. tableStyles creates a 3x3
matrix of styles but, when run through format, your matrix is 3x2.

However, there is an unrelated bug that this exposed since you are
using header = NULL. I'll need to fix that. A temporary work-around is
to get a blank header line via

   x <- matrix(rnorm(6), nc=2)
   rownames(x) <- letters[1:3] # create row names or have useRowNames = FALSE
   colnames(x) <- rep("", ncol(x))
   xst <- tableStyles(x, useRowNames = TRUE, header = NULL)
   odfTable(x, styles=xst,  colnames = NULL, useRowNames = TRUE)

or, since your data have no row names

   x <- matrix(rnorm(6), nc=2)
   xst <- tableStyles(x, useRowNames = FALSE, header = NULL)
   odfTable(x, styles=xst,  colnames = NULL, useRowNames = FALSE)

I'll be working on odfWeave Monday, so I'll try to get a fix out then.

Max




More information about the R-help mailing list