I have several R scripts, say a.R
, b.R
, c.R
. I want to paste all scripts together to one file and then use this file to generate a Notebook.
In a.R
, the code is
#' This is some text in a.R to be used in Notebook.
dat1 <- 1:10
In b.R
, the code is
#' This is some text in b.R to be used in Notebook.
dat2 <- dat1
In c.R
, the code is
#' This is some text in c.R to be used in Notebook.
dat3 <- dat2
I want to have an overall file all.R
and it should look like this:
#' This is some text in a.R to be used in Notebook.
dat1 <- 1:10
#' This is some text in b.R to be used in Notebook.
dat2 <- dat1
#' This is some text in c.R to be used in Notebook.
dat3 <- dat2
I could also manuelly copy everything together, but I do not want to because I will lose an overview of everything. I am wondering whether there is any more elegent way?
You could use
child
knitr chunck option: