Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Post: clean up after rmarkdown::render() #107

Open
gadenbuie opened this issue Mar 8, 2022 · 2 comments
Open

Post: clean up after rmarkdown::render() #107

gadenbuie opened this issue Mar 8, 2022 · 2 comments

Comments

@gadenbuie
Copy link
Owner

https://twitter.com/grrrck/status/1471191106671026177

@gadenbuie
Copy link
Owner Author

Oh wait, there is a secret hook if you spelunk deep enough! Try this:

setHook(
  "rmarkdown.onKnitCompleted",
  function(input_file) unlink("plot.png")
)

How on Earth did you find this?!

Thank you!!

--- Charlotte 👩‍💻 (@charliejhadley) December 15, 2021

Haha, you're welcome! I went straight to the source and found a hint
here: https://github.com/rstudio/rmarkdown/blob/48054f642a63d138a70476b661c05bd1706a5209/R/render.R#L756-L760

--- Garrick Aden-Buie (@grrrck) December 15, 2021

@gadenbuie
Copy link
Owner Author

Since I just had to search Twitter to remember the secret sauce (😱) it would be better to have a short post about this on my blog

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant