M. Beausoleil M. Beausoleil - 1 year ago 99
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?

Answer Source

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"))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download