
i
i
“K23166” — 2015/1/28 — 9:35 — page 207 — #233
i
i
i
i
i
i
12.7. MANIPULATING BIGGER DATASETS 207
> server = function(input, output) {
output$main_plot = renderPlot({
library(choroplethr); library(dplyr)
USArrests.st = mutate(USArrests,
region=tolower(rownames(USArrests)), value = Murder)
choroplethr(USArrests.st, "state", title="Murder Rates by State",
showLabels=input$labels, num_buckets=as.numeric(input$n_breaks))
})
}
> shinyApp(ui=ui, server=server)
The user interface is defined and saved in an object called ui by calling the function
bootstrapPage() and passing the result to the shinyUI() function. This defines two
selector widgets (through calls to selectInput() ...