|
| 1 | +--- |
| 2 | +title: Quarto Document |
| 3 | +format: |
| 4 | + html: |
| 5 | + echo: false |
| 6 | +--- |
| 7 | + |
| 8 | +Quarto enables you to weave together content and executable code into a |
| 9 | +finished document. To learn more about Quarto see <https://quarto.org>. |
| 10 | + |
| 11 | +## Workflow diagram |
| 12 | + |
| 13 | +This diagram depicts a simple workflow showing the |
| 14 | +[tidying](https://vita.had.co.nz/papers/tidy-data.html) and analysis of a data |
| 15 | +set with written findings reviewed by your peers. |
| 16 | + |
| 17 | +```{mermaid} |
| 18 | +stateDiagram-v2 |
| 19 | + direction LR |
| 20 | +
|
| 21 | + [*] --> tidy |
| 22 | + tidy --> analyze |
| 23 | + analyze --> tidy |
| 24 | + analyze --> write |
| 25 | + write --> review |
| 26 | + review --> write: feedback |
| 27 | + review --> accepted |
| 28 | + accepted --> [*] |
| 29 | +``` |
| 30 | + |
| 31 | +Your personal workflow may be more complicated than this example, but |
| 32 | +thankfully, Quarto lets you include |
| 33 | +[diagrams](https://quarto.org/docs/authoring/diagrams.html) to help you |
| 34 | +communicate how you work! |
| 35 | + |
| 36 | +## Penguins |
| 37 | + |
| 38 | +Quarto documents can incorporate interactive data exploration and analysis. |
| 39 | +One way of including these dynamic capabilities is by using [Observable |
| 40 | +JS](https://quarto.org/docs/interactive/ojs/) (OJS). |
| 41 | + |
| 42 | +This is a simple example based on Allison Horst's [Palmer |
| 43 | +Penguins](https://allisonhorst.github.io/palmerpenguins/) dataset. Here we |
| 44 | +look at how penguin body mass varies across both sex and species (use the |
| 45 | +provided inputs to filter the dataset by bill length and island): |
| 46 | + |
| 47 | +```{ojs} |
| 48 | +// https://observablehq.com/@observablehq/sample-datasets |
| 49 | +// https://allisonhorst.github.io/palmerpenguins/ |
| 50 | +filtered = penguins.filter(function(penguin) { |
| 51 | + return bill_length_min < penguin.culmen_length_mm && |
| 52 | + islands.includes(penguin.island); |
| 53 | +}) |
| 54 | +``` |
| 55 | + |
| 56 | +```{ojs} |
| 57 | +//| panel: input |
| 58 | +
|
| 59 | +viewof bill_length_min = Inputs.range( |
| 60 | + [32, 50], |
| 61 | + {value: 35, step: 1, label: "Bill length (min):"} |
| 62 | +) |
| 63 | +viewof islands = Inputs.checkbox( |
| 64 | + ["Torgersen", "Biscoe", "Dream"], |
| 65 | + { value: ["Torgersen", "Biscoe"], |
| 66 | + label: "Islands:" |
| 67 | + } |
| 68 | +) |
| 69 | +``` |
| 70 | + |
| 71 | +::: {.panel-tabset} |
| 72 | + |
| 73 | + |
| 74 | +## Plot |
| 75 | + |
| 76 | +```{ojs} |
| 77 | +Plot.rectY(filtered, |
| 78 | + Plot.binX( |
| 79 | + {y: "count"}, |
| 80 | + {x: "body_mass_g", fill: "species", thresholds: 20} |
| 81 | + )) |
| 82 | + .plot({ |
| 83 | + facet: { |
| 84 | + data: filtered, |
| 85 | + x: "sex", |
| 86 | + y: "species", |
| 87 | + marginRight: 80 |
| 88 | + }, |
| 89 | + marks: [ |
| 90 | + Plot.frame(), |
| 91 | + ] |
| 92 | + } |
| 93 | +) |
| 94 | +``` |
| 95 | + |
| 96 | +## Data |
| 97 | + |
| 98 | +```{ojs} |
| 99 | +Inputs.table(filtered) |
| 100 | +``` |
| 101 | + |
| 102 | +::: |
0 commit comments