Quarto edits (#1355)

* Remove dashboards

* Fix typos, make table legible

* Remove trailing slash
This commit is contained in:
Mine Cetinkaya-Rundel 2023-03-10 08:20:34 -05:00 committed by GitHub
parent ac74f985a5
commit 8cb1037e1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 100 deletions

View File

@ -125,32 +125,6 @@ Quarto supports a variety of presentation formats, including:
You can read more about creating presentations with Quarto at [https://quarto.org/docs/presentations](https://quarto.org/docs/presentations/).
## Dashboards
Dashboards are a useful way to communicate information visually and quickly.
A dashboard-like look can be achieved with Quarto using document layout options like sidebars, tabsets, multi-column layouts, etc.
For example, you can produce this dashboard:
```{r}
#| echo: false
#| fig-alt: |
#| Quarto dashboard with the title "Diamonds dashboard". The first
#| tab shows four plots of the diamonds dataset. The second tab
#| shows summary statistics for price and carat of diamonds. The third
#| tab shows an interactive data table of the first 100 diamonds.
knitr::include_graphics("quarto/quarto-dashboard.png")
```
Using this code:
```{r comment = "", echo = FALSE}
cat(readr::read_file("quarto/quarto-dashboard.qmd"))
```
To learn more about Quarto component layouts, visit <https://quarto.org/docs/interactive/layout.html>.
## Interactivity
Any HTML document can contain interactive components.

View File

@ -153,8 +153,9 @@ If you are at the beginning of a line (as shown in @fig-visual-editor), you can
```{r}
#| label: fig-visual-editor
#| echo: false
#| out-width: "75%"
#| fit-cap: |
#| fig-cap: |
#| Quarto visual editor.
#| fig-alt: |
#| A Quarto document displaying various features of the
@ -188,7 +189,7 @@ Most importantly, while the visual editor displays your content with formatting,
a. Add a footnote.
b. Add a horizontal rule.
c. Add a block quote.
4. In the visual editor, go to Insert \> Citation and insert a citation to the paper titled [Welcome to the Tidyverse](https://joss.theoj.org/papers/10.21105/joss.01686) using its DOI (digital object identifier), which is 10.21105/joss.01686. Render the document and observe how the reference shows up in the document. What change do you observe in the YAML of your document?
4. In the visual editor, go to Insert \> Citation and insert a citation to the paper titled [Welcome to the Tidyverse](https://joss.theoj.org/papers/10.21105/joss.01686) using its DOI (digital object identifier), which is [10.21105/joss.01686](https://doi.org/10.21105/joss.01686). Render the document and observe how the reference shows up in the document. What change do you observe in the YAML of your document?
## Source editor {#sec-source-editor}
@ -334,13 +335,13 @@ The following table summarizes which types of output each option suppresses:
| Option | Run code | Show code | Output | Plots | Messages | Warnings |
|------------------|:--------:|:---------:|:------:|:-----:|:--------:|:--------:|
| `eval: false` | \- | | \- | \- | \- | \- |
| `include: false` | | \- | \- | \- | \- | \- |
| `echo: false` | | \- | | | | |
| `results: hide` | | | \- | | | |
| `fig-show: hide` | | | | \- | | |
| `message: false` | | | | | \- | |
| `warning: false` | | | | | | \- |
| `eval: false` | X | | X | X | X | X |
| `include: false` | | X | X | X | X | X |
| `echo: false` | | X | | | | |
| `results: hide` | | | X | | | |
| `fig-show: hide` | | | | X | | |
| `message: false` | | | | | X | |
| `warning: false` | | | | | | X |
### Global options

View File

@ -43,5 +43,3 @@ superscript^2^ subscript~2~
|--------------|---------------|
| Content Cell | Content Cell |
| Content Cell | Content Cell |
/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 KiB

View File

@ -1,63 +0,0 @@
---
title: "💍 Diamonds dashboard"
format: html
execute:
echo: false
---
```{r}
#| label: setup
#| include: false
library(tidyverse)
library(gt)
```
::: panel-tabset
## Plots
```{r}
#| layout: [[30,-5, 30, -5, 30], [100]]
ggplot(diamonds, aes(x = carat)) + geom_histogram(binwidth = 0.1)
ggplot(diamonds, aes(x = price)) + geom_histogram(binwidth = 500)
ggplot(diamonds, aes(x = cut, color = cut)) + geom_bar()
ggplot(diamonds, aes(x = carat, y = price, color = cut)) + geom_point()
```
## Summaries
```{r}
diamonds |>
select(price, carat, cut) |>
group_by(cut) |>
summarize(
across(where(is.numeric), list(mean = mean, median = median, sd = sd, IQR = IQR))
) |>
pivot_longer(cols = -cut) |>
pivot_wider(names_from = cut, values_from = value) |>
separate(name, into = c("var", "stat")) |>
mutate(
var = str_to_title(var),
stat = str_to_title(stat),
stat = if_else(stat == "Iqr", "IQR", stat)
) |>
group_by(var) |>
gt() |>
fmt_currency(columns = -stat, rows = 1:4, decimals = 0) |>
fmt_number(columns = -stat, rows = 5:8,) |>
cols_align(columns = -stat, align = "center") |>
cols_label(stat = "")
```
## Data
```{r}
diamonds |>
arrange(desc(carat)) |>
slice_head(n = 100) |>
select(price, carat, cut) |>
DT::datatable()
```
:::

Binary file not shown.