Rendering with Code

You can have code (R, Python or Julia) in your qmd file. You will need to have these installed on your local computer, but presumably you do already if you are adding code to your qmd files.

x <- c(5, 15, 25, 35, 45, 55)
y <- c(5, 20, 14, 32, 22, 38)
lm(x ~ y)

Call:
lm(formula = x ~ y)

Coefficients:
(Intercept)            y  
      1.056        1.326  

Modify the GitHub Action

You will need to change the GitHub Action in .github/workflows to install these and any needed packages in order for GitHub to be able to render your webpage. The GitHub Action install R since I used that in code.qmd. If you use Python or Julia instead, then you will need to update the GitHub Action to install those.

If getting the GitHub Action to work is too much hassle (and that definitely happens), you can alway render locally and publish to the gh-pages branch. If you do this, make sure to delete or rename the GitHub Action to something like

render-and-publish.old_yml

so GitHub does not keep trying to run it. Nothing bad will happen if you don’t do this, but if you are not using the action (because it keeps failing), then you don’t need GitHub to run it.

Render locally and publish to gh-pages branch

To render locally and push up to the gh-pages branch, open a terminal window and then cd to the directory with the Quarto project. Type this in the terminal:

quarto render gh-pages