
Last chance! 50% off unlimited learning
Sale ends in
fig.path
, return the filename(s).fig_chunk(label, ext = "", number, fig.path = opts_chunk$get("fig.path"))
png
or pdf
1
)fig.path
foo
and figure path You can generate plots in a code chunk but not show them inside the code
chunk by using the chunk option fig.show = 'hide'
. Then you can use
this function if you want to show them elsewhere.
library(knitr)
fig_chunk("foo", "png")
fig_chunk("foo", "pdf")
fig_chunk("foo", "svg", 2) # the second plot of the chunk foo
fig_chunk("foo", "png", 1:5) # if the chunk foo produced 5 plots
Run the code above in your browser using DataLab