swcarpentry / DEPRECATED-bc

DEPRECATED: This repository is now frozen - please see individual lesson repositories.
Other
299 stars 383 forks source link

knitr working directory #674

Closed chendaniely closed 9 years ago

chendaniely commented 9 years ago

For the instructors teaching knitr, please take a look at this issue: https://github.com/yihui/knitr/issues/277

essentially knitr doesn't follow the same working directory as the rscript/r session. you actually need a code chunk to set the root directory opts_knit$set(root.dir = 'c:/Users/kwilliams/git/ProjectX')

There's been discussion on working directories and how/where to invoke R, etc in #639 and #658

Just figured this out, thought i'd share...

tomwright01 commented 9 years ago

I've been using this option, 1 caveat, the root directory only takes effect for subsequent chunks. Thus any source commands in the same chunk will not have the root directory set.

chendaniely commented 9 years ago

This might actually be fixed. If you invoke RStudio directly from the directory (apparently, as you should be), the relative directory issue all works the way you expect.

You might still have to do this if you use the Projects feature, but I haven't tested that/use those anymore.

jdblischak commented 9 years ago

@chendaniely, is there any action that needs to be taken on this issue? If yes, please detail. If no, please close.

chendaniely commented 9 years ago

No action needed. Closing this issue.