PathOS-project / indicator_handbook

6 stars 6 forks source link

Add causal introduction #47

Closed vtraag closed 2 months ago

vtraag commented 2 months ago

This PR adds the causal introduction (based on our preprint https://doi.org/10.31235/osf.io/4bw9e) to the general handbook.

The setup is now that the causal introduction is built in an isolated environment, so that it doesn't affect any of the other builds (see also https://quarto.org/docs/projects/code-execution.html#freeze-virtual-environments). That is, other parts of the overall Quarto project can then still have their own dependencies and environments, without it affecting or conflicting with the build environment for the causal introduction.

Note that there is one peculiar problem, which I haven't solved yet (but simply use a workaround). Apparently, when executing quarto render causal_intro, the here packages resolves to the overall project root, not causal_intro. The workaround is that here::here() needs to be prepended always with causal_intro as done in ce5f5261963af78ff60dfab4ef3e03518098b05b. However, it would be preferred if here would resolve in the directory being rendered, since now the subdirectory has a dependency on the parent project built in. Not sure how that should work, and couldn't find any open issues around this.

This now builds correctly locally, but we'll have to see how it does in the CI. There might still be some elements that are somehow not tracked by renv somehow, notably pdftools. So, let's see how this turns out. If necessary, we'll make some additional changes to get it up and running in the CI.

vtraag commented 2 months ago

@tklebel , would you have any idea why the renv fails here on trying to install Rcpp?

tklebel commented 2 months ago

It seems that Rcpp now works but curl has an issue? I'll try to resolve it.

tklebel commented 2 months ago

The system dependency issues have now been resolved @vtraag. However, it seems that renv is missing the quarto package.

Re-setting up the local library was quite a hassle, hope the build now succeeds.

tklebel commented 2 months ago

There seems to still be an issue, now with quarto. In essence, quarto is not able to find the knitr and rmarkdown installations. Maybe https://github.com/quarto-dev/quarto-cli/issues/4081 or https://stackoverflow.com/questions/76917859/error-using-quarto-in-r-markdown-package-there-is-no-package-called-rmarkdown could help in tracking down the issue. Could you look into that? I'm really short on time this week :/

vtraag commented 2 months ago

Thanks for taking a look @tklebel ! Part of the problem now seems to be that the renv is not loaded because quarto render does not load the renv from the causal_intro, even when specifying the subproject (i.e. quarto render causal_intro).

vtraag commented 2 months ago

Finally passed! I'll make some more minor cosmetic adjustments, and then I'll put it live. If you have any comments on the appearance still @tklebel let me know. Of course, you can always open a new issue if you want to change anything after this PR is merged.

vtraag commented 2 months ago

Once merged, this PR fixes #27.