[R] Novice Alert!: odfWeave help!

Jan van der Laan rhelp at eoos.dds.nl
Thu Mar 8 10:13:31 CET 2012


Step by step:

1. Create a new document in Open/LibreOffice
2. Copy/paste the following text into the document (as an example)

<<helloworld>>=
cat("Hello, world")
@

2. Save the file (e.g. "hello.odt")
3. Start R (if not already) shouldn't matter if its plain R/RStudio
4. Change working directory to the folder in which you odt-document resides

setwd("/path/to/your/file")

4. Load odfWeave

library(odfWeave)

5. odfWeave your document. All code-chunks are taken from your  
document, executed in R and the output of the R-commands is inserted  
into the resulting odt-document.

odfWeave("hello.odt", "hello_out.odt")

You can now open "hello_out.odt" (or whatever you named it) and see  
the resulting output.


HTH,

Jan







metatarsals <sjcastedo at gmail.com> schreef:

> Hello world,
> I'm pretty new to computer code: for example, I consider it a small
> victory that I (all by myself!) managed to ssh into the server at my
> lab from home and copy a file onto my desktop. Be gentle. I have
> primarily used R for running some pretty mid-level statistics
> (creating distance matrices, manipulating graphs for pretty figures,
> etc).
>
> I'm working through Bolker's Ecological Models and Data in R (which is
> a great book for ecologists/life sciences types who want to learn how
> to just barely get by in R, with know previous knowledge of R code
> presupposed). My advisor wants me to explore odfWeave to stream-line
> my notes. This is important because I will inevitably be his TA in his
> R stat course, and I will need to be proficient with the software. So
> far I have been copy-pasting my codes into a word processor (both open
> office and word) and inserting my plots after saving them.
>
> I do not understand how to use odfWeave. The way it was explained to
> me initially sounded like it was some kind of Open Office add-on I
> could install and my chunks of code would be automatically translated.
> Six hours of research later, I realize this is not the case, and that
> I need outside help. I'm on a Mac OSx 10.7.3 Lion, I normally use
> RStudios, but I have R and R64 and I operate at about, oh, let's say
> the level of a 2- or 3-year-old does with language and walking.
>
> So, what exactly does odfWeave do? Do I stick my chunks of code (I
> know I need to use << to start and @ to end to bracket off the
> sections of code) in the .odf document, then do the file.in/file.out
> commands, which then reads the code and pops out a pretty little graph
> to my specified parameters? Or do I use the file.in/file.out commands
> to paste code I've created in R into an existing .odf doc?
>
> Any baby steps or example code you could give me would warm my little heart.
>
> If the first scenario (write the code into an .odf document, set off
> as mentioned above, and then tell R to do stuff to it) is the
> scenario, I'd be happy to send an example.
>
> Thanks! I can offer a cute picture of a cat as payment, if desired!
>
>
> --
> View this message in context:  
> http://r.789695.n4.nabble.com/Novice-Alert-odfWeave-help-tp4455481p4455481.html
> Sent from the R help mailing list archive at Nabble.com.
> 	[[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.



More information about the R-help mailing list