JoeF
JoeF

Reputation: 853

Specify output directory for R script with knit_hooks$set(purl = hook_purl)

I understand that we shouldn't purl() a chunk with knitrbut instead use knit_hooks$set(purl = hook_purl). That works, but it puts the R script in the working directory. I would like to put it in an R/ directory. It's probably due to my own incompetence, but I couldn't find anything about specifying the directory for the R script (I looked in the R documentation as well as several places online). Anyone have any ideas? I'm knitting from within RStudio, by the way.

Upvotes: 2

Views: 348

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30134

You can generate the script under the current directory, and file.rename() it to the R/ directory.

Upvotes: 2

Related Questions