---
title: "Introduction to Quarto"
description:
  R Workshop
author: 
  - name: "Katia Bulekova"
    email: ktrn@bu.edu
    orcid:  0000-0003-1560-2146
    url: https://www.bu.edu/tech/support/research/
    affiliation: Boston University
date: "`r Sys.Date()`"
editor: visual
format: 
  html:
    code-fold: true
    code-link: true
---

## Quarto

**Introduction**

Quarto documentation and gallery can be found on their [website](https://quarto.org/).

Quarto [cheatsheet](https://rstudio.github.io/cheatsheets/quarto.pdf)

Below are some examples of the features that were added to RMarkdown notebooks.

## Additional text formatting:

**Check boxes**  

- [ ] Task 1
- [x] Task 2


**Interrupted lists**     

(@)  A list whose numbering
continues after

(@)  an interruption


**Term definition**    

Quarto
: An open-source scientific and technical publishing system



## Show code and hide code in the output

By default the code is executed, displayed in the output and output is rendered under it:

```{r}
library(MASS)
data(cats)

str(cats)

```

------------------------------------------------------------------------

*echo* option allows to display the output, but not show the code

```{r}
#| echo: false
str(cats)
```

------------------------------------------------------------------------

*eval* option allows to display the code, but not evaluate it. Additionaly, if we set *cold-fold* option to `true`, the code chunk will be displayed and not "folded" under Code arrow:

```{r}
#| eval: false
#| code-fold: false
str(cats)
```

## Automatic Figure labeling

@fig-airquality explores the impact of temperature on ozone level.

```{r}
#| label: fig-airquality
#| fig-cap: Temperature and ozone level.
#| warning: false

library(ggplot2)
data(airquality)

ggplot(airquality, aes(Temp, Ozone)) + 
  geom_point() + 
  geom_smooth(method = "loess"
)
```

## Code Linking

The *code-link* option in the header enables hyper-linking of functions within code blocks to their online documentation

```{r}
#| warning: false
#| code-fold: false

library(dplyr)

airquality %>%
  filter(!is.na(Ozone)) %>%
  mutate(Temp = (Temp-32)/9*5) %>%
  group_by(Month) %>%
  summarize( ave_temp = mean(Temp))
  
```

## Themes

There are currently 25 themes included in the Quarto. You can set a theme by adding a theme option to the header (e.g. `theme: darkly`)

More on themes, can be found Quarto's [HTML Themes webpage](https://quarto.org/docs/output-formats/html-themes.html)

## Lightbox

This feature is available only starting from Quarto version 1.4.

*Lightbox* images allow a reader to click to see a larger version of the image (including any caption).

To enable *lightbox* treatment for all images in a document add `lightbox: true` in the YAML header.

If you want to add this feature only to a specific image, add a `{.lightbox}` code after the link to the picture.

![BU Image](BU-image.jpg){.lightbox}

If you add `lightbox: auto` option into the YAML header, the graphs you produce in your computational cells will also have a *lightbox* treatment.

More on this feature can be found on Quarto's \[\](More on themes, can be found Quarto's [Lightbox Figures webpage](https://quarto.org/docs/output-formats/html-lightbox-figures.html)


**************

## Callouts:


::: callout-note
The callout-note can be used to draw attention to some information
:::

::: callout-warning
The callout-warning can be used for warnings
:::

::: callout-important
The callout-important can be to highligh important information
:::

::: {.callout-tip}
## Tip with Title

This is an example of a callout with a title.
:::

::: {.callout-caution collapse="true"}
## Expand To Learn About Collapse

This is an example of a 'folded' caution callout that can be expanded by the user. You can use `collapse="true"` to collapse it by default or `collapse="false"` to make a collapsible callout that is expanded by default.
:::

