[R] OdfWeave problem

Duncan Murdoch murdoch.duncan at gmail.com
Tue Dec 17 16:26:01 CET 2013


On 17/12/2013 10:00 AM, John Kane wrote:
> I am trying to get odfWeave to work and I seem to be doing something stupid. Straightforward inline statements and plain code chunks are working fine but when I try to use an actual odfWeave statement I get what appears to be the xml and not odt format.  I am using Apache OpenOffice 3. 4.0.  Sys.Info() at bottom.
> Suggestions/ pointers appreciated.
>
> In an odt file I tried the following:  The inline statements work, the dat1 chunk works the iris chunk gives me the following.
>
>
> > odfItemize(levels(iris$Species))
>       <text:list text:style-name="Rbullet" >
>       <text:list-item>
>        <text:p text:style-name="RbulletParagraph" > setosa     </text:p>
>       </text:list-item>
>       <text:list-item>
>        <text:p text:style-name="RbulletParagraph" > versicolor </text:p>
>       </text:list-item>
>       <text:list-item>
>        <text:p text:style-name="RbulletParagraph" > virginica  </text:p>
>       </text:list-item>
>      </text:list>
>
> ######--------------------------text in AOO file ------------------------------------
>
>   \Sexpr{paste(letters[1:5], collapse = ",")}. Okay so far, so good and π =  \Sexpr{round(pi, 4)}.
>
>
> <<dat1, echo=FALSE >>=
> Participant  <-  c(1,2,3,4,5,6,7,8,9,10)
> Condition <-factor(c(1,1,1,1,1,2,2,2,2,2))
> Score <- c(4,3,5,4,4,2,2,6,5,6)
> Data <- data.frame(Participant,Condition,Score)
> Data
> @
>
> <<iris , echo = TRUE>>=
> odfItemize(levels(iris$Species))
>   @

I don't use odfWeave, but by analogy with Sweave you probably need some 
"result=" or "output=" option in the header to this code chunk, to tell 
it not to escape everything, but just to include it as XML code to be 
processed.

Duncan Murdoch

> ###----------------------------end text in AOO file---------------
>
> ##----------------------------------R program----------------
> library(odfWeave)
> inFile <- "odfWeave.example.odt"
> outFile <- "outfile.odt"
>
> odfWeave(inFile, outFile)
> #===================================
>       
>   Sys.info()
>                                        sysname                                       release
>                                        "Linux"                           "3.11.0-14-generic"
>                                        version                                      nodename
> "#21-Ubuntu SMP Tue Nov 12 17:07:40 UTC 2013"                                   "john-K53U"
>                                        machine                                         login
>                                         "i686"                                     "unknown"
>                                           user                                effective_user
>                                         "john"                                        "john"
>
>
>
>
> John Kane
> Kingston ON Canada
>
> ____________________________________________________________
> FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
>
> ______________________________________________
> 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.



More information about the R-help mailing list