Week 1
Quarto
Installation & Setup
The installation procedure will differ depending on how you choose to work with the Quarto publishing system. Below we go into the following 2 situations:
- Using Quarto with Python or R in Visual Studio Code
- Using Quarto with R in RStudio
It is also possible to use Quarto with Python in Jupyter notebooks. We do not go into that situation in this workshop for now. Just know that it is possible by installing a Python installation, Jupyter lab (e.g., via Anaconda) and Quarto (see Quarto documentation).
Besides R and Python, Quarto can also work with other programming languages, such as Julia or Observable, and it can interact with other software as well, like Neovim and simple Text editors.
A. Install Quarto and your programming language
1. Install Visual Studio Code
Install Visual Studio Code (VS Code) using the set-up instructions for your operating system.
- Download VS Code from https://code.visualstudio.com/
- Walk through the installation steps. The default installation location is usually fine. If you have administrator rights, we recommend to Add VS Code to the PATH if you’re using Windows.
2. Set up Python and/or R for use in VS Code
- R: Follow the instructions here for installing R and using it in VS Code.
- In VS Code, you can open an R terminal to install the
languageserver
package.
- In VS Code, you can open an R terminal to install the
- Python: Follow the instructions here for installing a Python interpreter, or see the installation instructions in our Introduction to Python workshop.
- Be sure to also install the Jupyter extension in VS Code if you wish to work with Jupyter notebooks (
.ipynb
).
- Be sure to also install the Jupyter extension in VS Code if you wish to work with Jupyter notebooks (
3. Install Quarto
- Download Quarto from https://quarto.org/docs/get-started/
- Open the msi/executable file. Answer “Yes” to the pop-up question “Do you want to allow this app to make changes to your device?”. Then start the set-up wizard.
- Choose
Install for all users
. If you do not have administrator rights, selectInstall just for you
. - Choose the installation location, usually the default proposed location is fine.
- Installation will start. After installation, click Finish.
4. Make VS Code, Quarto and R/Python talk to each other
Now that everything is installed, we need to make sure VS Code can use Quarto and Python/R.
- Open VS Code.
- Open the Extensions view in VS Code (
Ctrl+Shift+X
on Windows and Linux,Cmd+Shift+X
on macOS) - Install the Quarto extension from the Extensions view in VS Code.
- If you want to use Python in VS Code:
- From the Extensions view in VS Code, install the Python extension.
- Set the Python interpreter: Open the command palette in VS Code (
Ctrl+Shift+P
on Windows and Linux,Cmd+Shift+P
on macOS), type “Python: Select Interpreter”, and select the relevant Python interpreter from the interpreters that VS Code can find.
- If you want to use R in VS Code: install the R extension from the extensions view in VS Code.
- Check whether Quarto is detected:
- Open a new terminal: Terminal > New terminal.
- Type
quarto --version
- If a version number appears, Quarto is detected.
- Check whether Python is detected:
- Open a new terminal or use the one that you used in step 6a.
- Type
python --version
- If a version number appears, Python is detected.
- Check whether R is detected: if you can open an R terminal, it shows you the R version and R is detected successfully.
1. Install R and Rstudio
If you do not yet have an installation for R and Rstudio, you need to install them on your device.
- If you have a personal device with administrator/installation rights:
- Install R from https://cran.rstudio.com/
- Install Rstudio from https://posit.co/download/rstudio-desktop/#download
- If your RStudio version is older than
v2022.07
, then you should update it. Quarto recommends using the latest version of RStudio (currently v.2023.06).
2. Install Quarto and R Markdown
- In the RStudio console, type
install.packages("rmarkdown")
andinstall.packages("quarto")
- Load both packages with
library(rmarkdown)
andlibrary(quarto)
- Restart RStudio.
- Check whether Quarto is detected: go to the Terminal (next to the Console) and type
quarto --version
. Alternatively, go toFile
>New project
>New directory
and check whether the Quarto outputs are presented as options (Quarto project, Quarto website, Quarto blog, Quarto book)