use_tidyjs: Use tidyjs

View source: R/tidyjs.R

use_tidyjsR Documentation

Use tidyjs

Description

Adds the HTML dependencies required for tidy.js.

Usage

use_tidyjs(minified = TRUE, remote = FALSE)

html_dependency_tidyjs(minified = TRUE, remote = FALSE)

html_dependency_d3_array(minified = TRUE, remote = FALSE)

Arguments

minified

Use the minified JavaScript files

remote

When TRUE, only the versions hosted on https://www.unpkg.com will be used.

Details

To use tidy.js in your R Markdown documents, call use_tidyjs(). You can then access tidy functions from the Tidy object in your Shiny App or in your R Markdown document inside a JavaScript (js) chunk:

```{r echo=FALSE}
tidyjs::use_tidyjs()
```

```{js}
const { tidy, mutate, arrange, desc } = Tidy;

const data = [
  { a: 1, b: 10 }, 
  { a: 3, b: 12 }, 
  { a: 2, b: 10 }
]

const results = tidy(
  data, 
  mutate({ ab: d => d.a * d.b }),
  arrange(desc('ab'))
)
```

Functions

  • use_tidyjs(): Add the tidy.js and dependencies to your document or app

  • html_dependency_tidyjs(): The tidy.js dependency

  • html_dependency_d3_array(): The d3-array dependency


gadenbuie/tidyjs-r documentation built on April 13, 2025, 2:58 a.m.