I'm a new in exams so maybe this question is very newbie.
I can't source external R-file (contains re-usable functions) into my .Rnw.
MWE:
functions.r:
x <- 10
question.Rnw
<<echo=FALSE>>=
source('functions.r')
@
\begin{question}
$x=\Sexpr{x}$
\end{question}
generate.r
library('exams')
exams2moodle('question.Rnw')
When I try Rscript generate.r:
Loading required namespace: rmarkdown
Error: chunk 1
Error in file(filename, "r", encoding = encoding) :
cannot open the connection
In addition: Warning message:
In file(filename, "r", encoding = encoding) :
cannot open file 'functions.r': No such file or directory
Execution halted
How can I re-use own R-functions in some questions?