Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aoles/shinyURL
:link: Save and restore the state of Shiny app's widgets by encoding them in an URL query string
https://github.com/aoles/shinyURL
bookmarks r shiny
Last synced: 27 days ago
JSON representation
:link: Save and restore the state of Shiny app's widgets by encoding them in an URL query string
- Host: GitHub
- URL: https://github.com/aoles/shinyURL
- Owner: aoles
- Created: 2014-10-13T13:56:12.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-08T13:25:50.000Z (over 8 years ago)
- Last Synced: 2024-11-09T00:52:56.636Z (about 1 month ago)
- Topics: bookmarks, r, shiny
- Language: R
- Homepage:
- Size: 82 KB
- Stars: 81
- Watchers: 8
- Forks: 21
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-shiny-extensions - shinyURL - Save and restore the state of a Shiny app by encoding the values of user inputs and active tab panels in the app's URL query string. (Backend / URL Routing)
- jimsghstars - aoles/shinyURL - :link: Save and restore the state of Shiny app's widgets by encoding them in an URL query string (R)
README
[![Build Status](https://travis-ci.org/aoles/shinyURL.svg)](https://travis-ci.org/aoles/shinyURL)
## Installation
# install.packages("devtools")
devtools::install_github("aoles/shinyURL")## Use
1. Load the package in both **server.R** and **ui.R**.
library("shinyURL")
2. In **server.R**, add inside the server function a call to
shinyURL.server()
where `session` is the argument passed to the server function.
3. Add the shinyURL widget to **ui.R**.shinyURL.ui()
### Restoring of tabset and navbar panelsTo save and restore active tabs provide the `id` argument to the functions `tabsetPanel` or `navbarPage`.
### Disable encoding of certain inputs
You can suppress certain inputs from being encoded in the query URL by using IDs with a leading dot, e.g. `.inputName`. These inputs won't be restored.
## Limitations
### Long URLs
The state of a shiny app gets saved by encoding its input values into an URL. To keep the URL compact and to avoid problems caused by the URL length limit (around 2000 characters) there are some points to keep in mind when developing your app.
1. Avoid long names of inputs but rather use short IDs. For example, instead of
selectInput("firstDrug", "First drug", choices = drugs)
it's better to haveselectInput("d1", "First drug", choices = drugs)
2. Use named lists for the `choices` argument in `radioButtons` and `checkboxGroupInput`. Then only the names are displayed to the user allowing for shorter values of the control.
These points are especially relevant for apps with lots of controls.
### Action buttons
Unfortunately, operations performed using action buttons cannot be reliably recorded and restored.