Building Web Applications with Shiny in R
Ramnath Vaidyanathan
VP of Product Research
A web app is a thing that updates based on user input/interaction
plot_kmeans(
data = iris,
x = 'Sepal.Length',
y = 'Sepal.Width',
nb_clusters = 3
)
library(shiny)
ui <- fluidPage(
h1('K-Means Clustering App'),
selectInput('x', 'Select x', names(iris), 'Sepal.Length'),
selectInput('y', 'Select y', names(iris), 'Sepal.Width'),
numericInput('nb_clusters', 'Select number of clusters', 3),
plotly::plotlyOutput('kmeans_plot')
)
server <- function(input, output, session){
output$kmeans_plot <- plotly::renderPlotly({
plot_kmeans(iris, input$x, input$y, input$nb_clusters)
})
}
shinyApp(ui = ui, server = server)
Building Web Applications with Shiny in R