Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/computations/ojs.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ OJS works in any Quarto document (plain markdown as well as Jupyter and Knitr do

We'll start with a simple example based on Allison Horst's [Palmer Penguins](https://allisonhorst.github.io/palmerpenguins/) dataset. Here we look at how penguin body mass varies across both sex and species (use the provided inputs to filter the dataset by bill length and island):

```{ojs}
data = FileAttachment("palmer-penguins.csv").csv({ typed: true })
```

```{ojs}
filtered = data.filter(function(penguin) {
return bill_length_min < penguin.bill_length_mm &&
Expand Down Expand Up @@ -57,9 +61,9 @@ Plot.rectY(filtered,
)
```

Let's take a look at the source code for this example. First we create an `{ojs}` cell that reads in some data from a CSV file using a [FileAttachment](https://observablehq.com/@observablehq/file-attachments):
Let's take a look at the source code for this example. First we create an `{ojs}` cell that reads in some data from a CSV file (*e.g.*, [`palmer-penguins.csv`](palmer-penguins.csv){target="_blank" download="palmer-penguins.csv"}) using a [FileAttachment](https://observablehq.com/@observablehq/file-attachments):

```{ojs}
```{{ojs}}
data = FileAttachment("palmer-penguins.csv").csv({ typed: true })
```

Expand Down