Skip to content

Working directory is forced for each chunk? #277

@kenahoo

Description

@kenahoo

I asked a question over on the RStudio site, but apparently RStudio isn't actually involved, so I ended up over here.

It seems that during knit(), the working directory is forced back to the directory of the input document before every chunk is evaluated. So it's not possible to setwd() to my project directory at the top of the .Rmd document, then keep that directory for all the rest of the chunks.

Is this on purpose?

I see that in issue #38 it's now allowed to call setwd() - but it won't do me much good. =)

In my case, I've got my project directory, which has subdirectories docs/, data/, src/, and so on. To me, it makes sense to specify all paths relative to the project directory root, not the directory within docs/ that the .Rmd document happens to live in. That's why I call setwd() in the first place. And putting all the documents at the top level isn't an option, things would clobber each other since there are multiple documents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions