Sourcing scripts for whole projects and related questions #3544
Unanswered
tomas-brito-devoto
asked this question in
Q&A
Replies: 1 comment
-
I also found this option, but I'm not sure how to implement it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I'm writing my thesis in Quarto and I have an data-processing.R script where I do all the computations for data analysis, tables and graphs generation. When trying to include some inline code in other chapters (i.e.
r nrow(my_table)
), it doesn't work. The only way i've managed to make it work is by including asource("scripts/data-processing.R"
at the beggining of the chapter. While I could include this in every chapter, I wonder if there's a better way.I've tried different options like including
sys.source("scripts/data-processing.R", envir = knitr::knit_global())
in the index.qmd, and theproject: pre-render: "scripts/data-processing.R"
option in the YAML, but neither work. Another option would be{{< include scripts/data-processing.R>}}
but I don't know how it would be different fromsource()
(also, I'm not sure where to type the underscore to ignore/not include the text in the final rendered manuscript).Related questions include:
execute: freeze: auto
andcache:true
in the _yml. of the project. Will it double the cache/space if Isource()
or{{< include >}}
the data processing script in every chapter?cache: TRUE
I only cache the R chunks, right? Should I have both options enabled to speed up rendering and avoid recalculating everything? Or am I doubling the disk space used needlessly?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions