[R] several odfWeave questions
Max Kuhn
mxkuhn at gmail.com
Wed Aug 25 21:18:22 CEST 2010
Ben,
> 1a. am I right in believing that odfWeave does not respect the
> 'keep.source' option? Am I missing something obvious?
I believe it does, since this gets passed directly to Sweave.
> 1b. is there a way to set global options analogous to \SweaveOpts{}
> directives in Sweave? (I looked at odfWeaveControl, it doesn't seem to
> do it.)
Yes. There are examples of this in the 'examples' package directory.
> 2. I tried to write a Makefile directive to process files from the
> command line:
>
> %.odt: %_in.odt
> $(RSCRIPT) -e "library(odfWeave);
> odfWeave(\"$*_in.odt\",\"$*.odt\");"
>
> This works, *but* the resulting output file gives a warning ("The file
> 'odftest2.odt' is corrupt and therefore cannot be opened.
> OpenOffice.org can try to repair the file ..."). Based on looking at
> the contents, it seems that a spurious/unnecessary 'Rplots.pdf' file is getting
> created and zipped in with the rest of the archive; when I unzip, delete
> the Rplots.pdf file and re-zip, the ODT file opens without a warning.
> Obviously I could post-process but it would be nicer to find a
> workaround within R ...
Get the latest version form R-Forge. I haven't gotten this fix onto
CRAN yet (I've been on a caret streak lately).
> 3. I find the requirement that all file paths be specified as absolute
> rather than relative paths somewhat annoying -- I understand the reason,
> but it goes against one practice that I try to encourage for
> reproducibility, which is *not* to use absolute file paths -- when
> moving a same set of data and analysis files across computers, it's hard
> to enforce them all ending up in the same absolute location, which then
> means that the recipient has to edit the ODT file. It would be nice if
> there were hooks for read.table() and load() as there are for plotting
> and package/namespace loading -- then one could just copy them into the
> working directory on the fly.
> has anyone experienced this/thought of any workarounds?
> (I guess one solution is to zip any necessary source files into the archive beforehand,
> as illustrated in the vignette.)
You can set the working directory with the (wait for it...) 'workDir'
argument. Using 'workDir = getwd()' will pack and unpack the files in
the current location and you wouldn't need to worry about setting the
path. I use the temp directory because I started over-wrting files.
Max
More information about the R-help
mailing list