Roman Luštrik
Roman Luštrik

Reputation: 70633

have knitr output figures in different formats

Let's say I have a long report that produces a lot of figures which knitr makes as pdfs and it works really well with LaTeX. At the end of the project, my co-authors would like to have also raster based figures. One option would be to convert everything using ImageMagick. Another option would be to specify for each chunk dev = c("jpg", "pdf"), but given the number of figures, this could be cumbersome.

Is there a global switch to make knitr produce figures in pdf and other formats at the same time?

Upvotes: 3

Views: 129

Answers (1)

adibender
adibender

Reputation: 7568

I think in the preamble

opts_chunk$set(dev = c("pdf", "jpg"))

should do. Within a R-chunk of course.

Upvotes: 5

Related Questions