Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ablack3/shinyPivot
A pivot table module for Shiny built on dplyr
https://github.com/ablack3/shinyPivot
Last synced: 8 days ago
JSON representation
A pivot table module for Shiny built on dplyr
- Host: GitHub
- URL: https://github.com/ablack3/shinyPivot
- Owner: ablack3
- License: other
- Created: 2018-04-18T20:51:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-25T01:15:29.000Z (over 5 years ago)
- Last Synced: 2024-08-13T07:15:18.141Z (4 months ago)
- Language: R
- Size: 72.3 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - ablack3/shinyPivot - A pivot table module for Shiny built on dplyr (R)
README
# shinyPivot - R package under construction
A pivot table module for Shiny built on dplyr.This is an R package containing three functions that allow for easy construction of pivot tables using Shiny.
It is built on dplyr so it should work with local dataframes and remote database connections (tbl_dbi objects from the dbplyr package).
When a remote database table is used the summarization and filtering take place in the database and only the result is brought into R.
This allows for pivot tables that work on large datasets housed in fast column oriented databases.The package contains three functions:
- get_pivot_vars
- pivot_module_UI
- pivot_moduleThe user should be familiar with shiny modules. https://shiny.rstudio.com/articles/modules.html
A simple example app looks like this.
```
library(shiny)
library(dplyr)# local table
df1 <- starwars %>%
select_if(is.character)# using a database
con <- DBI::dbConnect(RSQLite::SQLite(), path = ":memory:")
copy_to(con, df1, "star_wars")
df2 <- tbl(con, "star_wars")pivot_vars1 <- get_pivot_vars(df1)
pivot_vars2 <- get_pivot_vars(df2)ui <- fluidPage(title = "R pivot table",
tabsetPanel(
tabPanel( "Local pivot", pivot_module_UI(id = "id1", pivot_vars = pivot_vars1)),
tabPanel("Database pivot", pivot_module_UI(id = "id2", pivot_vars = pivot_vars2))
)
)server <- function(input, output, session){
callModule(pivot_module, id = "id1", ns_id = "id1", df = df1, pivot_vars = pivot_vars1)
callModule(pivot_module, id = "id2", ns_id = "id2", df = df2, pivot_vars = pivot_vars2)
}shinyApp(ui = ui, server = server)
```