Andrew tries Quarto

Quick notes on how to make a blog with Quarto and also targets.

UdeS
stan
Author

Andrew MacDonald

Published

November 11, 2022

library(targets)
library(ggplot2)
library(tidyverse)
library(tidybayes)

What is this post

This post is meant to be a simple template for new posts – when I make a new post I’ll start by copying and pasting this current one over. Probably in the future there will be a plugin that does this for us, but until then this will be fine.

Why I switched to Quarto

A simple and frequent answer: overenthusiasm! I like seeing all the new things that the Rstudio team develop, and I know that this vibrant community will keep adding features and tutorials

quarto resources

surprise it’s targets

via GIPHY

I’m also using targets. Here are some observations on that so far:

  • Last error: ! System command 'quarto' failed I get this error message more that 10x more often than any other. As I’m learning Quarto I keep making errors which break the Quarto process but targets doesn’t (yet?) communicate the specific error message. To find out what has gone wrong, I go over to the terminal and run quarto render .

  • you have to go into _metadata.yml and stop the posts from freezing, by setting freeze: false . Targets will handle all the rest of it.

I’m using targets with quarto because I want to work with large bayesian models fit with stan and brms., and fitting them in a regular blog post – including compiling, sampling etc.

My own observations and questions

so far it is very straightforward!

  • ~it seems like post folder cant begin with dates?~ you can start a folder with a date, and I do, so that the posts sort in at least approximately the right temporal sequence. However the date for a post comes from the YAML, not the folder name.

  • love LOVE the bibliography automatically appearing

  • DO think about changing the working directory for chunk evaluations to the project root, as described here. This is really important because that is the directory that targets uses when sourcing files. For example tar_load(my_target_name) will load in an object from your pipeline. But run this same line from an .qmd file in a subfolder (say posts/yourpostname/index.qmd), then THAT will be the location the computer looks in..