Skip to content

Commit

Permalink
Merge pull request #1537 from quarto-dev/sync-1533-to-prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
cderv authored Jan 14, 2025
2 parents e488dca + 5dfce11 commit 1c1a3c5
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit 1c1a3c5

Please sign in to comment.