M. Beausoleil M. Beausoleil - 10 months ago 55
Markdown Question

Seeing the content of a script sourced in a Markdown document (RStudio)

I just want to print the content of an R script sourced in another location.

```{r Model}

But this is just sourcing the script and not showing it. Is there a way to do this?


Sure, just read the lines and then write them back out:

```{r Model, comment=NA}
cat(paste(readLines("~/Desktop/model_sim_simple_that_I_want_to_show.R), collapse="\n"))