Is there any way to generate documentation for a R shiny application?
It becomes very hard to maintain a shiny application without documentation.
It seems that all the eco-system of tests/documentation is created for an R package structure. Maybe we can emulate/extend this behavior for a shiny application?
An example :
A reactive expression is typically an R shiny element taht can contain complex data structure.
filtered_dat <- reactive({
dx[ NAME == input$crr & TOU == input$tou &
PlotYear == input$year. & PlotMonth == input$season]
})
To give more context, I am here in the context of building a complete web application using R shiny. All the business-logic is wrapped in a separated package(s).
For testing Ui I think it is complicated ( one can use Rselenium for example) , but generating doc from roxygen2
comments is just parsing. It should be easy to have such tool.
Shiny is an R package that makes it easy to build interactive web apps straight from R. You can host standalone apps on a webpage or embed them in R Markdown documents or build dashboards. You can also extend your Shiny apps with CSS themes, htmlwidgets, and JavaScript actions.
A Shiny app consists of two parts, a user interface ( ui ) and an R session that runs code and returns results ( server ). These two parts can be in their own files called ui. R and server.
Shiny is an R package that enables building interactive web applications that can execute R code on the backend. With Shiny, you can host standalone applications on a webpage, embed interactive charts in R Markdown documents, or build dashboards.
It is a great question. How do you create a complex clear web application with Shiny?I believe that organize a huge project is the weakness of Shiny architecture.
First, Shiny creates a web in only one html document. This document is divided in layers, to develop a huge application you need to manage correctly the layers. However, this thing presents a significant problem, how do you organize the code?
Well, here, there are different ways to do that. Indeed you can apply different methods like Joe Cheng:
In my case, in a huge project I implemented the MVC pattern but adapting it to the Shiny architecture.
Add an example of shiny application
There is not an ideal solution but this is basically what I am doing to deal with my shiny applications to create a robust and well "documented" shiny application:
A typical package will have this structure:
R
ui-view1.R
ui-view2.R
server-server1.R
server-server2.R
controls.R
Here an example:
app
ui.R
server.R
global.R
views
view1.R
view2.R
servers
server1.R
server2.R
init
global1.R
gloabl2.R
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With