
shinyAssemble reads Shiny applications code ( one file app.R with ui, server )
to Visualize shiny application's structure ( as Assembly Instruction Style :stuck_out_tongue_winking_eye: )
note that, hovering node will show element's type !
use this code
remotes::install_github('jhk0530/shinyAssemble')
library(shinyAssemble)
shinyAssemble()
push investigate button.
push module button. (optional)


```R # Define UI for dataset viewer app ---- ui <- fluidPage(
# App title ---- titlePanel("Shiny Text"),
# Sidebar layout with a input and output definitions ---- sidebarLayout(
# Sidebar panel for inputs ---- sidebarPanel(
# Input: Selector for choosing dataset ----
selectInput(
inputId = "dataset",
label = "Choose a dataset:",
choices = c("rock", "pressure", "cars")
),
# Input: Numeric entry for number of obs to view ----
numericInput(
inputId = "obs",
label = "Number of observations to view:",
value = 10
)
),
# Main panel for displaying outputs ---- mainPanel(
# Output: Verbatim text for data summary ----
verbatimTextOutput("summary"),
# Output: HTML table with requested number of observations ----
tableOutput("view")
) ) )
server <- function(input, output) {
# Return the requested dataset ---- datasetInput <- reactive({ switch(input$dataset, "rock" = rock, "pressure" = pressure, "cars" = cars ) })
# Generate a summary of the dataset ---- output$summary <- renderPrint({ dataset <- datasetInput() summary(dataset) })
# Show the first "n" observations ---- output$view <- renderTable({ head(datasetInput(), n = input$obs) }) } ```
### Example 2 Miles per Gallon
### Codes
``` R # Define UI for miles per gallon app ---- ui <- fluidPage(
# App title ---- titlePanel("Miles Per Gallon"),
# Sidebar layout with input and output definitions ---- sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
# Input: Selector for variable to plot against mpg ----
selectInput(
"variable", "Variable:",
c(
"Cylinders" = "cyl",
"Transmission" = "am",
"Gears" = "gear"
)
),
# Input: Checkbox for whether outliers should be included ----
checkboxInput("outliers", "Show outliers", TRUE)
),
# Main panel for displaying outputs ----
mainPanel(
# Output: Formatted text for caption ----
h3(textOutput("caption")),
# Output: Plot of the requested variable against mpg ----
plotOutput("mpgPlot")
)
) )
mpgData <- mtcars mpgData$am <- factor(mpgData$am, labels = c("Automatic", "Manual"))
server <- function(input, output) {
# Compute the formula text ---- # This is in a reactive expression since it is shared by the # output$caption and output$mpgPlot functions formulaText <- reactive({ paste("mpg ~", input$variable) })
# Return the formula text for printing as a caption ---- output$caption <- renderText({ formulaText() })
# Generate a plot of the requested variable against mpg ---- # and only exclude outliers if requested output$mpgPlot <- renderPlot({ boxplot(as.formula(formulaText()), data = mpgData, outline = input$outliers, col = "#75AADB", pch = 19 ) }) }
```
### Result

colourpicker - 1.0
shinyjs - 1.1
If you load both colourpicker and shinyjs library, they will make collision. shinyAssemble only needs to load colourpicker and use R shinyjs::runjs() instead load shinyjs
use styled code, (more specifically I used tidyverse style with styler)
https://jhkim.shinyapps.io/shinyAssemble/
Copyright :copyright: 2020 Jinhwan Kim
This project is MIT licensed
This README was generated with :two_hearts: by shinyReadme
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.