odfweave table styles

3 messages Options
Embed this post
Permalink
Colin Robertson

odfweave table styles

Reply Threaded More More options
Print post
Permalink
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?

Thanks in advance,


Colin Robertson

PhD Candidate
Dept of Geography
University of Victoria

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
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.
Max Kuhn

Re: odfweave table styles

Reply Threaded More More options
Print post
Permalink
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 <[hidden email]> 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?
>

______________________________________________
[hidden email] mailing list
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.
Colin Robertson

Re: odfweave table styles

Reply Threaded More More options
Print post
Permalink
Thanks! The formattingOut.odt document had exactly what I needed. The style
"highlight" wasnt defined in my environment.

Cheers,

Colin


On Wed, Nov 4, 2009 at 4:59 AM, Max Kuhn <[hidden email]> wrote:

> 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 <[hidden email]>
> 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?
> >
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
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.