October 1, 2018
According to Shiny from RStudio:
leaflet and plotlylibrary(shiny)
ui <- fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins", "Number of bins:",
min = 1, max = 50, value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)
)
server <- function(input, output) {
# generate bins based on input$bins from ui.R
# draw the histogram with the specified number of bins
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
# Run the application
shinyApp(ui = ui, server = server)
plotly::renderPlotly and plotly::plotlyOutputh1 through h6em, code, img, br…tags list to pick required tagHTML to write HTML codes directlyhelpText to create help textssubmitButton, or more versatile, actionButtonWrapped by reactive function
# It's like creating a function
cal_diff <- reactive({
input$total1 - input$total2
})
cal_diff()ggplot2 into Shinyggplot2 functions
aes_string in ggplotpaste and as.formula in facet_grid