yihui/knitr — Issue #162: Specify working directory
Author: gabysbrain
Created: 2012-03-03 20:18:47+00:00
State: open

I have an R script that reads a source markdown from stdin, saves it to a temporary file (in `/tmp`), runs it through knitr, and then writes the processed file to stdout. This lets me get a live preview of my R computations in Marked.app on the mac.

I used to set the input.dir option before calling knit to change the working directory in which knit processes the R code. This way I could keep data references relative to my source document. With version 0.3.0 input.dir looks like it's always set to the directory of the input file. This doesn't work in my case where the input and output file are temporary files.

Would it be possible to check first if input.dir is set and only change it if it's not? The other option is to have a separate option for specifying the working directory.