Chris Warth
Chris Warth

Reputation: 938

Can knitr deal with multiple .Rmd files in the same directory?

I am using knitr to generate markdown that I then convert to html using markdown::markdownToHTML()

knitr will place figures for .Rmd file in a figure/ subdirectory. If I process multiple .Rmd files in the same directory, however, the figures can get overwritten. Naming each chunk with a name that is unique across all .Rmd files makes uniquely named figures, but that is error prone. Reusing a name by accident will silently overwrite older figures.

Is there an easy way to use different figure/ directories or otherwise separate the figures for each .Rmd file?

Upvotes: 3

Views: 307

Answers (1)

Jeff Johnston
Jeff Johnston

Reputation: 146

Yes, you can use:

opts_chunk$set(fig.path = "other_directory")

In each document to override the default figure/ path.

Upvotes: 4

Related Questions