Quarto Projects

are directories that provide the ability to…

  • render all or some of the files in a directory with a single command (e.g. quarto render myproject)

  • share a YAML configuration across multiple documents

  • redirect output artifacts to another directory

  • freeze rendered output (i.e. don’t re-execute documents unless they have changed)

Types of Projects

Use the quarto create project command (in the terminal) to create a new project:

Terminal
quarto create project

You will then be given a variety of options for projects:

Output
 ? Type
  default
   website
   blog
   manuscript
   book
   confluence

Say we chose to make a website…


Our website would come pre-populated with five initial files:

A screenshot of the five files that come premade when you create a new Quarto website in RStudio. The files are named _quarto.yml, about.qmd, index.qmd, styles.css, trial-website.Rproj.

Let’s talk about each file!

.Rproj – Where does your analysis live?

R has a powerful notion of a working directory–where R looks for files that you ask it to load, and where it will store any files that you ask it to save.

R for Data Science

RStudio shows your current working directory at the top of the console:

.Rproj – Where does your analysis live?

Keeping all the files associated with a given project (data, R scripts, figures, etc.) together in one directory is such a wise and common practice that RStudio has built-in support for this via RStudio projects (.Rproj).


A translucent blue cube with a capital R in the center. The image is the logo of an RStudio project.

File Paths (😩)

Inside a .Rproj, you can access files using a relative path. Absolute paths should never be used!


If I wanted to access the students.xlsx file in the data folder of my project, I could use data/students.csv to access these data.

A screen shot of the same project as displayed previously (with five files), but a data folder has been added to the project files.

This is different from the full path (where the file lives on my computer): /Users/atheobol/Desktop/trial-website/data/students.csv.

.yml Files

_quarto.yml
project:
  type: website

website:
  title: "trial-website"
  navbar:
    left:
      - href: index.qmd
        text: Home
      - about.qmd

format:
  html:
    theme: cosmo
    css: styles.css
    toc: true

editor: visual

.css

A Cascading Style Sheets (CSS) file is a style sheet language used in web development to describe the presentation and formatting of documents written in HTML or XML.

index.qmd

  • This is the home page for the website!

  • Whatever you place in the index.qmd file will be the first page people see!

  • This page is also accessed using the top navigation menu (on the left side) using the link titled “Home.”

about.qmd

  • This is an additional content page!
  • This is accessed through the top navigation menu.
  • Notice that the .yml file doesn’t give this page a name, so it defaults to the title included in the about.qmd document.

Website Themes

format:
  html:
    theme: cosmo
    css: styles.css
    toc: true

Here is a list of every theme available for Quarto websites: https://quarto.org/docs/output-formats/html-themes.html


Optionally, you can set separate “light” and “dark” themes:

theme:
  light: flatly
  dark: darkly

How would you integrate websites into a course?

Projects

Are students already completing a project that includes R?

Why not transform this project into something they can publish?

https://sta199-s24.github.io/project/description.html

Personal Websites