Reputation: 2297
Sorry for a question that might sounds silly. I have some r codes that I stored atC:/Users/SQ/Documents
. And I am making a rmarkdown and would like to call two program from this diretory:A.R
and B.R
. How should I call those two codes?
I tried:
setwd("C:/Users/SQ/Documents/")
source(file.path("A.R")local = knitr::knit_global()) # not working;
read_chunk(file.path("B.R")) ## still don't work
what should be the correct way to call those two program?
If I want my output to be store in C:/Users/SQ/desktop
. should I set directory as C:/Users/SQ/desktop
and use another way to call those two program? Could anyone give me some guidance?
Many thanks.
Upvotes: 1
Views: 630
Reputation: 1751
No need to change the working directory. It should work as simply as:
Some text chunk....
#```{r, your_code_chunk, eval = TRUE, echo = FALSE}
#source("C:/Users/SQ/Documents/A.R")
#source("C:/Users/SQ/Documents/B.R")
#```
Obs: Ignore the #
symbols, I had to use them to represent the backticks in here!
Next text chunk...
Upvotes: 3