Rmd output to different directory

Hi all,

I am trying to get my r markdown output to different directory
So my Rmd file is in c: drive but I need the markdown output in H: drive can I do that.. please suggest
Thank you

Hi! You can use the output_file argument of the rmarkdown::render function. Like so:

rmarkdown::render("test.Rmd", output_file = "/path_to_folder/test.html")

Using output_file is one option.

Path handling is not easy inside rmarkdown::render() so you could also do the copying yourself.
Etiher:

  • Render the output where your source is & move the output where you want - all using R code
  • Copy the source in your destination location & render their your output.

Sometimes this is the safest solution so that everything works fine.

Hope it helps

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.