[R] problem with odfWeave

Joel GOMBIN joel.gombin at gmail.com
Wed Jan 27 16:01:11 CET 2010


Attached is the "input" file ("modele_rapport.odt") and one example of
output file ("rapport_Abstention2.odt") (I run a loop with the same report
generated for different datasets). I hope this is what you are looking for ?

Joel

On Wed, Jan 27, 2010 at 3:56 PM, Ista Zahn <istazahn at gmail.com> wrote:

> Joel, I still don't see an example. I think you're making things more
> difficult for yourself than you need to, but without an example I
> don't know what exactly you're doing.
>
> -Ista
>
> On Wed, Jan 27, 2010 at 8:34 AM, Joel GOMBIN <joel.gombin at gmail.com>
> wrote:
> > Hi,
> >
> > so to sum up, I'm making automated reports, in the form of tables. In
> each
> > cell of the table is an expression like (e.g.) :
> >
> > \Sexpr{odfCat(round(summary(get(modele1))$coefficients[1,1],2))}
> >
> > For most cells, after I run odfWeave, the results are correctly put and
> > formatted. But in some cells (always the same), the output.odt file has
> the
> > original expression (e.g.
> > \Sexpr{odfCat(round(summary(get(modele1))$coefficients[1,1],2))}) instead
> of
> > the result of the evaluation of the expression.
> >
> > When I look at the content.xml code of the input file, I see that in
> these
> > cells where the evaluation is not proprely run, I have something like :
> >
> > <text:p text:style-name="P4">
> > \Sexpr{odfCat(round(summary(get(modele1))$coefficients[2,
> > <text:soft-page-break/>
> > 1],2))}
> > </text:p>
> >
> > instead of the regular
> >
> > <text:p text:style-name="P4">
> > \Sexpr{odfCat(round(summary(get(modele1))$coefficients[2,1],2))}
> > </text:p>
> >
> > So my question is : how can I get rid of these <text:soft-page-break/>
> tags
> > that appeared for no apparent reason ? Is there a way to configure
> > OpenOffice Writer so that he won't put such tags ?
> >
> > Thanks a lot,
> >
> > Joel
> >
> >
> >
> > On Wed, Jan 27, 2010 at 1:54 PM, Ista Zahn <istazahn at gmail.com> wrote:
> >>
> >> Hi Joel,
> >> Can you paste a minimal example illustrating your problem?
> >> Thanks,
> >> Ista
> >> On Wed, Jan 27, 2010 at 6:19 AM, Joel GOMBIN <joel.gombin at gmail.com>
> >> wrote:
> >> > Hello,
> >> >
> >> > thanks to Sarah for her help. That works fine, except for one thing.
> >> > When I
> >> > generate my reports, using odfWeave(), some cells in my tables are
> >> > filled
> >> > with the expression I put in the input file (/Sexpr(...)) instead of
> the
> >> > result of its evalutation. I suspected there was a problem in the XML
> >> > code ;
> >> > indeed, when I look at the content.xml file of the input ODT file,
> there
> >> > are
> >> > some <text:soft-page-break/> tags in the middle of cells.
> >> >
> >> > Is it any way of instructing OpenOffice not to put these tags, or do I
> >> > have
> >> > no other choice than removing them by hand in the content.xml file ?
> >> >
> >> > Thanks a lot in advance,
> >> >
> >> > Joel
> >> >
> >> > On Wed, Jan 6, 2010 at 7:12 PM, Sarah Goslee <sarah.goslee at gmail.com>
> >> > wrote:
> >> >
> >> >> Hi Joel,
> >> >>
> >> >> If you actually want to make a table, you need to use odfTable. There
> >> >> are examples
> >> >> in the help for that function. Same for odfCat, but instead of
> >> >> creating a table, that will
> >> >> print your output.
> >> >>
> >> >> eg to print your output:
> >> >>
> >> >> <<echo=FALSE>>=
> >> >>    odfCat("some random normal data:", rnorm(5)) # from the help file
> >> >> @
> >> >>
> >> >> or to make a table:
> >> >>
> >> >> <<echo=FALSE>>=
> >> >>    x <- matrix(1:12, ncol=3)
> >> >>    colnames(x) <- c("a", "b", "c")
> >> >>    odfTable(x)
> >> >>    odfTableCaption("A useless table")
> >> >> @
> >> >>
> >> >> ODT files are actually compressed XML files. If you just print from
> >> >> within R, there are no
> >> >> XML tags around your output and OpenOffice has no idea what to do
> with
> >> >> it.
> >> >> The
> >> >> various odfSomething R functions wrap the R output in XML tags so OOo
> >> >> will
> >> >> understand it in the final output.
> >> >>
> >> >> Sarah
> >> >>
> >> >> On Wed, Jan 6, 2010 at 12:41 PM, Joel GOMBIN <joel.gombin at gmail.com>
> >> >> wrote:
> >> >> > Hello,
> >> >> >
> >> >> > I have encountered problems using odfdWeave. I actually have the
> same
> >> >> error
> >> >> > message as was reported in this message (
> >> >> > http://tolstoy.newcastle.edu.au/R/e6/help/09/01/0872.html), but I
> >> >> > don't
> >> >> > quite understand the answer made by Max Kuhn ("You need to cat the
> >> >> results
> >> >> > using odfCAt, otherwise you are just writing the output with no XML
> >> >> around
> >> >> > it."). What I am supposed to do exactly ?
> >> >> >
> >> >> > What I'm trying to do is writing values I have computed earlier in
> >> >> > the
> >> >> cells
> >> >> > of a table in an ODT file.
> >> >> >
> >> >> > I'm very grateful in advance for any help...
> >> >> >
> >> >>
> >> >>
> >> >> --
> >> >> Sarah Goslee
> >> >> http://www.functionaldiversity.org
> >> >>
> >> >
> >> >        [[alternative HTML version deleted]]
> >> >
> >> > ______________________________________________
> >> > R-help at 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.
> >> >
> >>
> >>
> >>
> >> --
> >> Ista Zahn
> >> Graduate student
> >> University of Rochester
> >> Department of Clinical and Social Psychology
> >> http://yourpsyche.org
> >
> >
>
>
>
> --
> Ista Zahn
> Graduate student
> University of Rochester
> Department of Clinical and Social Psychology
> http://yourpsyche.org
>


More information about the R-help mailing list