[R] odfweave table styles

Max Kuhn mxkuhn at gmail.com
Wed Nov 4 13:59:05 CET 2009


It's hard to say without a reproducible example or the output form
sessionInfo().

Before doing that though, did you read the 31 page document
"formattingOut.odt" (or the corresponding pre-odfWeave document) in
the examples folder of the package?

Max

On Tue, Nov 3, 2009 at 8:14 PM, Colin Robertson <colinr23 at gmail.com> wrote:
> Hello List,
>
> Does anyone have examples of custom formatting of tables in odfweave? I know
> there is an example of this in the formatting.odt file that comes with the
> package, but running that through odfweave gives the following error:
>
> Error:  chunk 13 (label=showTableStyles)
> Error in names(x) <- value :
>  'names' attribute [1] must be the same length as the vector [0]
>
> What I am really trying to do is replicate this part which highlights one
> row
>
> <<modTableStyles>>=
> bigState <- which.max(tableData[, "Area"])
> tableStyles$text[bigState,] <- "ArialHighlight"
> tableStyles$cell[bigState,] <- "highlight"
> tableStyles$text
> @
>
> In my code I do:
>
> <<modtablestyles, echo=FALSE>>=
>  bluesYes <- which(outTable[,2] >= 3 & outTable[,2] < 4)
>  namel <- colnames(outTable)
>  tstyles <- tableStyles(outTable, useRowNames = F, header = namel)
>  tstyles$cell[bluesYes,2] <- "highlight"
> @
> <<corrTable,echo=FALSE,results=xml>>=
>  odfTable(outTable, styles = tstyles, useRowNames = F, colnames = namel)
> @
>
> My code runs and does not throw an error, but the resulting table does not
> have the rows I asked for highlighted. If I check the tableStyles object the
> values of $cell are properly set as I want. What are valid values that
> tableStyles$cell can be set to? Does this have to be a custom style defined
> in the ODT file beforehand?
>



More information about the R-help mailing list