Shiny App Compact Definition
12 Feb 2015Following is an Idea to define Shiny application as one structure instead of splitting Server and UI parts.
For example, a signle file shiny app
server <- function(input, output) {
output$distPlot <- renderPlot({
hist(rnorm(input$obs), col = 'darkgray', border = 'white')
})
}
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
sliderInput("obs", "Number of observations:", min = 10, max = 500, value = 100)
),
mainPanel(plotOutput("distPlot"))
)
)
Can be coded using following syntax. I.e. tags are started with **
**shiny
**sidebar
**slider='obs' 'Number of observations:' min=10 max=500 value=100
**main
**plot=distPlot
function={
hist(rnorm(input$obs), col = 'darkgray', border = 'white')
}
**shiny
**shiny
**fluid
**select=region, 'Region:', choices = colnames(WorldPhones))
**plot=phonePlot function={
barplot(WorldPhones[,input$region]*1000,
ylab = "Number of Telephones", xlab = "Year")
}
**shiny
It is just an idea, there is no working parser.