R - Shiny

R - Shiny

153 bookmarks
Custom sorting
Making Tables Shiny: DT, formattable, and reactable
Making Tables Shiny: DT, formattable, and reactable
Demo of popular packages for generating interactive tables suitable for Shiny apps
formattable Another nice table-making package is formattable. The cute heatmap-style colour formatting and the easy-to-use formatter functions make formattable very appealing. color_tile() fills the cells with a colour gradient corresponding to the values color_bar() adds a colour bar to each cell, where the length is proportional to the value The true_false_formatter() defined below demonstrates how to define your own formatting function, in this case formatting TRUE, FALSE and NA as green, red and black.
If you want the features of both DT and formattable, you can combine them by converting the formattable() output to as.datatable(), and much of the formattable features will be preserved.
However, one problem I had was that when using DT::datatable, missing values (NA) are left blank in the display (which I prefer), but in the converted from formattable() version, NA’s are printed. Also, color_bar columns seem to be converted to character, which can no longer be sorted numerically.
reactable Next I tried reactable, a package based on the React Table library.
Columns are customised via the columns argument, which takes a named list of column definitions defined using colDef(). These include format definitions created using colFormat.
In the end, I used DT::datatable() in my Shiny app, because I found it the easiest, fastest, and most comprehensive. I’ve been able to achieve most of the features I wanted using just DT.
Heatmap-like fill effect:
apply the formatStyle() function to the output of datatable() to set the backgroundColor for selected columns:
Abbreviate long cells
Sometimes some cells have a large amount of text that would mess up the table layout if I showed it all. In these cases, I like to abbreviate long values and show the full text in a tooltip. To do this, you can use JavaScript to format the column to show a substring with “…” and the full string in a tooltip (<span title="Long string">Substring...</span) when values are longer than N characters (in this case 10 characters). You can do this using columnDefs and pass JavaScript with the JS() function:
Really plain table Sometimes I don’t need any of the faff. Here’s how to get rid of it all:
headerCallbackRemoveHeaderFooter <- c( "function(thead, data, start, end, display){", " $('th', thead).css('display', 'none');", "}" )
datatable( my_pic_villagers, options = list( dom = "t", ordering = FALSE, paging = FALSE, searching = FALSE, headerCallback = JS(headerCallbackRemoveHeaderFooter) ), selection = 'none', callback = JS( "$('table.dataTable.no-footer').css('border-bottom', 'none');" ), class = 'row-border', escape = FALSE, rownames = FALSE, filter = "none", width = 500 )
·clarewest.github.io·
Making Tables Shiny: DT, formattable, and reactable
rstudio/shiny: Easy interactive web applications with R
rstudio/shiny: Easy interactive web applications with R
Easy interactive web applications with R.
Compared to event-based programming, reactivity allows Shiny to do the minimum amount of work when input(s) change, and allows humans to more easily reason about complex MVC logic.
An attractive default look based on Bootstrap which can also be easily customized with the bslib package or avoided entirely with more direct R bindings to HTML/CSS/JavaScript.
Tools for improving and monitoring performance, including native support for async programming, caching, load testing, and more.
·github.com·
rstudio/shiny: Easy interactive web applications with R
Shiny - Stop-Trigger-Delay
Shiny - Stop-Trigger-Delay
Shiny is a package that makes it easy to create interactive web apps using R and Python.
observeEvent() is used to perform an action in response to an event eventReactive() is used to create a calculated value that only updates in response to an event
observe() and reactive() functions automatically trigger on whatever they access observeEvent() and eventReactive() functions need to be explicitly told what triggers them
And where does isolate fit in all this? isolate() is used to stop a reaction observeEvent() is used to perform an action in response to an event eventReactive() is used to create a calculated value that only updates in response to an event
·shiny.posit.co·
Shiny - Stop-Trigger-Delay
Fastest Growing R Shiny App Store
Fastest Growing R Shiny App Store
Showcase your R shiny application and grow your user base. Real time usage stats and reviews for all your apps. Contribute today.
·shinyappstore.com·
Fastest Growing R Shiny App Store
Why you should learn Javascript to master R Shiny. And how to get started - datahabits.io
Why you should learn Javascript to master R Shiny. And how to get started - datahabits.io
Although the concealment of Javascript is by design and makes Shiny in the first instance easy to use, in the long run when you want to build serious and more visual appealing apps, you most likely need to utilize javascript to make most of the web framework
·datahabits.io·
Why you should learn Javascript to master R Shiny. And how to get started - datahabits.io
Best Practice: Development of Robust Shiny Dashboards as R Packages
Best Practice: Development of Robust Shiny Dashboards as R Packages
This article describes best practice approaches for developing shiny dashboards. The creation of the dashboard in package form, as well as the use of unit tests should enable the development of robust solutions and guarantee high quality.
·inwt-statistics.com·
Best Practice: Development of Robust Shiny Dashboards as R Packages
shinycovr
shinycovr
Contribute to yonicd/shinycovr development by creating an account on GitHub.
·github.com·
shinycovr
Forget about Excel, Use these R Shiny Packages Instead - Appsilon Data Scie
Forget about Excel, Use these R Shiny Packages Instead - Appsilon Data Scie
Transferring your Excel sheet to a Shiny app is perhaps the easiest way to create an enterprise ready dashboard. Shiny offers a comparable feature set to Excel as well as exciting new possibilities.
·appsilon.com·
Forget about Excel, Use these R Shiny Packages Instead - Appsilon Data Scie
Using Shiny with Scheduled and Streaming Data · R Views
Using Shiny with Scheduled and Streaming Data · R Views
Note: This article is now several years old. If you have RStudio Connect, there are more modern ways of updating data in a Shiny app. Shiny applications are often backed by fluid, changing data. Data updates can occur at different time scales: from scheduled daily updates to live streaming data and ad-hoc user inputs. This article describes best practices for handling data updates in Shiny, and discusses deployment strategies for automating data updates.
·rviews.rstudio.com·
Using Shiny with Scheduled and Streaming Data · R Views
Super Solutions for Shiny Architecture 2/5: Javascript Is Your Friend - App
Super Solutions for Shiny Architecture 2/5: Javascript Is Your Friend - App
Three methods for using javascript code in Shiny applications to build faster apps, avoid unnecessary re-rendering, and add components beyond Shiny's limits. Part 2 of a 5 part series on super solutions for Shiny architecture.
·appsilon.com·
Super Solutions for Shiny Architecture 2/5: Javascript Is Your Friend - App
Productionizing Shiny and Plumber with Pins · R Views
Productionizing Shiny and Plumber with Pins · R Views
Producing an API that serves model results or a Shiny app that displays the results of an analysis requires a collection of intermediate datasets and model objects, all of which need to be saved. Depending on the project, they might need to be reused in another project later, shared with a colleague, used to shortcut computationally intensive steps, or safely stored for QA and auditing. Some of these should be saved in a data warehouse, data lake, or database, but write access to an appropriate database isn’t always available.
·rviews.rstudio.com·
Productionizing Shiny and Plumber with Pins · R Views
Building a shiny app with drag and drop data interface
Building a shiny app with drag and drop data interface
Introduction Data visualization is an important aspect of the data science work flow. This app enables the analyst to understand the data in question. In this post, we will build an application whi…
·pradeepadhokshaja.wordpress.com·
Building a shiny app with drag and drop data interface
Shiny 1.0.4
Shiny 1.0.4
Shiny 1.0.4 is now available on CRAN. To install it, run: install.packages("shiny") For most Shiny users, the most exciting news is that file inputs now support dragging and dropping: It is now possible to add and remove tabs from a tabPanel, with the new functions insertTab(), appendTab(), prependTab(), and removeTab(). It is also possible to hide and show tabs with hideTab() and showTab(). Shiny also has a new a function, onStop(), which registers a callback function that will execute when the application exits.
·blog.rstudio.com·
Shiny 1.0.4