Skip to content

Commit

Permalink
Docs: Displaying Tables
Browse files Browse the repository at this point in the history
  • Loading branch information
georgestagg committed Jul 30, 2024
1 parent c5a78a4 commit 7d7fbfe
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 13 deletions.
6 changes: 3 additions & 3 deletions docs/interactive/hybrid.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ plot(si1$depth, si1$price)
head(si1)
```

### Passing data between engines
## Passing data between engines

The same mechanism can be used to pass data between WebAssembly engines
The mechanism described in the previous section can also be used to pass data between WebAssembly engines.

#### Source

Expand Down Expand Up @@ -119,4 +119,4 @@ import pandas as pd
df = pd.DataFrame(mpg)
plt.plot(df['mpg'], df['hp'], 'o')
plt.show()
```
```
4 changes: 3 additions & 1 deletion docs/interactive/reactivity.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ do_penguins_density(measure, species);
```
````

#### Ouptut
#### Output

## Overview

```{webr}
#| edit: false
Expand Down
45 changes: 36 additions & 9 deletions docs/other/tables.qmd
Original file line number Diff line number Diff line change
@@ -1,19 +1,46 @@
---
format: live-html
title: "Tables"
title: Displaying Tables
webr:
render-df: gt-interactive
engine: knitr
toc: true
---

The `render-df` option changes how `data.frame`s are rendered by default.
It can be one of:
{{< include ../_extensions/live/_knitr.qmd >}}

* `default`
* `paged-table`
* `gt`
* `gt-interactive`
* `DT`
* `reactable`
For `webr` interactive code cells the `render-df` document YAML option can be used to change how `data.frame` objects are rendered in the output.

### Available Options

| option | Description |
|--------|-------------|
| `default` | Default output, text as if output at an R console. |
| `paged-table` | Render with [`rmarkdown::paged_table()`](https://pkgs.rstudio.com/rmarkdown/reference/paged_table.html). |
| `kable` | Render with [`knitr::kable()`](https://bookdown.org/yihui/rmarkdown-cookbook/kable.html). |
| `gt` | Render with [`gt::gt()`](https://gt.rstudio.com/reference/gt.html). |
| `gt-interactive` | Render with `gt::gt()` as [an interactive table](https://gt.rstudio.com/reference/opt_interactive.html). |
| `DT` | Render with [`DT::datatable()`](https://rstudio.github.io/DT/). |
| `reactable` | Render with [`reactable::reactable()`](https://glin.github.io/reactable/reference/reactable.html). |

### Example

#### Source

````{.markdown filename="table.qmd"}
----
format: live-html
webr:
render-df: gt-interactive
----

```{{webr}}
mtcars
```

````

#### Output

```{webr}
mtcars
Expand Down
1 change: 1 addition & 0 deletions docs/reference/options.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ title: Code cell options
| `hint` | `false` | Create exercise hint block. |
| `setup` | `false` | Create exercise setup block. |
| `solution` | `false` | Create exercise solution block. |
: {tbl-colwidths="[10,10,80]"}

0 comments on commit 7d7fbfe

Please sign in to comment.