Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/feddelegrand7/pivta
Create an Interactive Pivot Table with Data Analysis Tools
https://github.com/feddelegrand7/pivta
htmlwidg pivot-tables r rstats shiny
Last synced: about 1 month ago
JSON representation
Create an Interactive Pivot Table with Data Analysis Tools
- Host: GitHub
- URL: https://github.com/feddelegrand7/pivta
- Owner: feddelegrand7
- License: other
- Created: 2020-07-07T02:10:44.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-09T21:50:04.000Z (about 4 years ago)
- Last Synced: 2024-08-03T22:18:42.184Z (4 months ago)
- Topics: htmlwidg, pivot-tables, r, rstats, shiny
- Language: CSS
- Homepage:
- Size: 4.03 MB
- Stars: 27
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - feddelegrand7/pivta - Create an Interactive Pivot Table with Data Analysis Tools (CSS)
- awesome-shiny-extensions - pivta - R wrapper for WebDataRocks, an interactive pivot table component for data analysis. (UI Components / Table)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# pivta
`pivta` is an R wrapper of the [WebDataRocks](https://www.webdatarocks.com/) JavaScript library. The package allows you to implement an interactive pivot table (among other data analysis features) throughout an HTML Widget.
The library supports CSV and JSON data. __Note that this is a free version of the WebDataRocks library, as such the data file uploaded should not exceed 1MB__. Nonetheless, that's fair for most modest data sets
You can install the development version of `pivta` from Github using:
```{r, eval=FALSE}
# install.packages("remotes")
remotes::install_github("feddelegrand7/pivta")
```
# How to use pivta
Just run `pivta()` and start playing ! The function has three main arguments:
+ _dsource_: Optional. Allows you to specify ex-ante the location of the csv/json data frame, by providing a URL.
+ _sep_: The CSV data frame separator. Defaults to comma (","). Will be ignored if data is JSON.
+ _report_: Optional. Allows you to specify ex-ante the location of your JSON report file (see below).In Shiny, you'll have to use the `pivtaOutput()` and `renderPivta()` functions.
# Examples
Let's work with the [CSV](https://gist.githubusercontent.com/feddelegrand7/b366864aabf9653361f461cbf972d97c/raw/a62c4672f2f5824b2634a66c948e6258d7c65323/mpg.csv) file of the [mpg](https://ggplot2.tidyverse.org/reference/mpg.html) data frame. You can upload the file locally or specify its URL using the __source__ argument.
```{r, eval=FALSE}
library(pivta)pivta()
```
![](man/figures/pivexample1.gif)
We can make some cool analysis:
![](man/figures/pivexample2.gif)
You can easily change the aggregation measure. Here let's take a look at the Average:
![](man/figures/pivexample3.gif)
Too many numbers after the decimal ? no worry, it's possible and easy to format the results:
![](man/figures/pivexample4.gif)
You can export your results into different format :
![](man/figures/pivexample5.gif)
The results can also be saved into a JSON file. If you want to retrieve the results the next time that you open your Shiny app you can either upload it locally or store it remotely and provide a URL that points to the report (within the __report__ argument of the `pivta()` function).
Below an example of the usage of `pivta()` on Shiny:
```{r, eval=FALSE}
library(shiny)
library(pivta)
library(ggplot2)ui <- fluidPage(
h1("The Pivot Table"),
pivtaOutput(outputId = "pivot_table"),
h1("The Plot"),
plotOutput(outputId = "plt1"))
server <- function(input, output) {
output$pivot_table <- renderPivta({
pivta(dsource = "https://gist.githubusercontent.com/feddelegrand7/b366864aabf9653361f461cbf972d97c/raw/a62c4672f2f5824b2634a66c948e6258d7c65323/mpg.csv")
})
output$plt1 <- renderPlot({
ggplot(mpg, aes(cty, hwy)) +
geom_point(col = "#324C63")
})
}shinyApp(ui = ui, server = server)
```
![](man/figures/pivexample6.gif)
Finally, feel free to try the other features provided by the WebDataRocks JS library. You can read the complete documentation [here](https://www.webdatarocks.com/doc/)
## Code of Conduct
Please note that the pivta project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.