R Rencontres 2016 - Toulouse
library(shiny) shinyUI(bootstrapPage( selectInput(inputId = "n_breaks", label = "Nb de barres :", choices = c(10, 20, 35, 50), selected = 20), sliderInput(inputId = "bw_adjust",label = "Ajustement de la courbe :", min = 0.2, max = 2, value = 1, step = 0.2), plotOutput(outputId = "main_plot", height = "300px") ))
library(shiny) shinyServer(function(input, output) { output$main_plot <- renderPlot({ hist(faithful$eruptions, probability = TRUE, breaks = as.numeric(input$n_breaks), xlab = "Durée (minutes)", main = "Durée de l'éruption du geyser") dens <- density(faithful$eruptions, adjust = input$bw_adjust) lines(dens, col = "blue") }) })
library(shiny) updateSelectizeInput(..., server = TRUE)
library(leaflet) popout <- function(x, d) { y <- paste(d$marque, '<br>', paste0(d$prix, ' euros / litre'), '<br>')} palette<- colorQuantile(palette = colorlist, domain = d$prix, probs= probs) leaflet(d()) %>% addProviderTiles(...) %>% addCircleMarkers(color = ~palette(prix),popup = popout(d()), layerId = d()$id)%>% addLegend(...)