How to combine .rmd and .r files?

I've been writing text separate from my code.

The datasets that I use are large, so I'm not sure about copypasting from my .R file to .Rmd.

Is there some way to add the output (plots, tables...) from my .R file into the .Rmd?

One style of rmarkdown is to create all the objects to be treated in an R script then bring them into namespace in the setup chunk individually, through readRDS or similar or sourcing the whole script. It will depend a lot on the specific script and goals of the rmarkdown presentation, but most often I find myself doing a mix where I do the extract-transform-load in the script and all the plots and tables in Rmd using objects from the script. If I'm confident that the objects won't be changing , I'll use Rds, otherwise on-the-fly.

Some resources about leveraging R files for Rmd report:

One of this could be helpful for your usage

This topic was automatically closed 21 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.