[R] odfWeave error

Emmanuel Charpentier charpent at bacbuc.dyndns.org
Mon Dec 3 10:43:07 CET 2007


Cleber N. Borges a écrit :
> hello all,
> I trying to use the package 'odfWeave'
> and I get the follow error:
> 
> 
> 
> ###  error message
> #############################################################
> ...
>   Removing content.xml
> 
>   Post-processing the contents
> Error in .Call("RS_XML_Parse", file, handlers, as.logical(addContext),  :
>   Error in the XML event driven parser for content_1.xml: error parsing 
> attribute name
> 
> 
> 
> The piece of the code is:
> 
> ###  code
> ############################################################
> ...
> 
> <<makeGraph, echo=T, results=xml>>=
> fileplot='C:\\DADOS\\tmp\\plotx.emf'
> win.metafile(fileplot)
> plot( rnorm(300), col='red', t='l', lwd=2 ); grid()
> dev.off()
> @

???? This chunk is pure R code and shouldn't output anything directly in
the output file. Since you are telling "echo=T', whatever is output by
your code is sent to your output file, and since you assert
"results=xml",this output is interpreted as xml ; since this isn't XML,
your're getting guff from the XML interpreter.

I'd rather do :
<<makeGraph, echo=FALSE>>=
invisible({
# Whatever you did ...
})
@
instead. Your second chunk :

> <<insertGraph, echo=T, results=xml>>=
> odfInsertPlot(file=fileplot, height=5, width=5 )
> @

should insert your plot in the output file.

[Snip ... ]

BTW : Windows (enhanced) metafile are Windows-specific. As far as I can
tell, recent versions of Office and OpenOffice.org correctly render
Encapsulated Postcript files, thus freeing you from another Windows
demendency. Unless you *have* to have an EMF output (it happens, I know
...), youd'better use use this format directly.

HTH

					Emmanuel Charpentier



More information about the R-help mailing list