Sarah,

Thank you very much, this an easy solution that works very well!

On a more complicated note, is there a way to embed the station name in a
header or footer of the document? It seems there is no way to evaluate a
chunk or an inline \Sexpr{...} in a header or footer?
This would put station ID on every report page, making reading & comparing
multiple reports much easier. Right now, if reports are converted to PDF,
they all have title "\Sexpr{listString(letters[1:5])}" making navigation
between them very cumbersome. I could adjust the title in ODT, but again,
cannot embed any variable into it. Is there a way to set the title from
odfWeave?

Thank you,
Aleksey


On Fri, Feb 26, 2010 at 3:48 PM, Sarah Goslee <sarah.gos...@gmail.com>wrote:

> I tend to do it the other way around.
>
> Hard-code the station into the ODT file as "thisstation".
>
> Then, in R, do something like this:
>
> allstations <- c("station1", "station2", "station3")
>
> for (i in allstations) {
>   thisstation <- i
>   odfWeave("inputfile.odt", paste("output-", i, ".odt", sep=""))
> }
> rm(thisstation)
>
> That way you don't have to have a bunch of files.
>
> Sarah
>
> On Fri, Feb 26, 2010 at 3:43 PM, Aleksey Naumov <anau...@gmail.com> wrote:
> > Dear R and odfWeave users,
> >
> > I am looking for a way to automate generation of many reports using
> > odfWeave. All reports would use the same input ODT file, the only
> difference
> > would be in the name of the dataset which will be analyzed in any
> particular
> > report. Right now, the name of the dataset is hardcoded in the first code
> > chuck in the input file:
> >
> > <<01 get data, echo=TRUE>>
> > station = '123'                  # name of the station dataset to be
> > analyzed in this report
> > data = get_data(station)    # get data, e.g. from a database
> > @
> >
> > This is far from ideal, as it requires a separate input file (ODT) for
> every
> > input station, a huge duplication.
> >
> > Are there ways to streamline this? I am looking for a way to have only
> one
> > input ODT file (much easier to maintain one file than many). I am
> thinking
> > that the input file could be pre-processed to include the station
> parameter
> > and saved as an intermediate ODT, which would then be put through
> > odfWeave()? Does anyone know of a good way to edit the OO.org ODT file to
> > put "station = '...'" into the first code chuck?
> > Is there any other way to do that?
> >
> > Thank you,
> > Aleksey
>
> --
> Sarah Goslee
> http://www.functionaldiversity.org
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to