gadenbuie / tidyjs-r

Tidy Data with JavaScript and tidy.js

Home Page:https://pkg.garrickadenbuie.com/tidyjs-r

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tidyjs

Tidy up your data with JavaScript for R users. Bring tidy.js to your R Markdown HTML documents or Shiny apps.

Be sure to check out the tidy.js homepage or GitHub repo at pbeshai/tidy.

Installation

You can install the released version of tidyjs from GitHub:

# install.packages("remotes")
remotes::install_github("gadenbuie/tidyjs-r")

Usage

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'))
)
```

Check out tidy.js in action in the interactive README.

About

Tidy Data with JavaScript and tidy.js

https://pkg.garrickadenbuie.com/tidyjs-r

License:Other


Languages

Language:R 100.0%