inst/shiny-apps/helloWorld/server.R

library(shiny)
library(dplyr)
library(ggplot2)
library(cea20160329)

shinyServer(function(input, output) {
  # Envia um gráfico para o ui.R
  output$distPlot <- renderPlot({
    dados <- pnud %>%
      filter(ano == 2010)

    # Isso aqui é a sintaxe do pacote "ggplot2"
    p <- ggplot(dados, aes(x=idhm_l, y=idhm_e, size=idhm_r)) +
      geom_point(alpha = 0.1, colour = 'darkgreen') +
      theme_bw()

    # Se o smooth estiver tickado...
    if(input[['smooth']] == TRUE) {
      p <- p + geom_smooth()
    }
    print(p)
  })
})
jtrecenti/cea20160329 documentation built on May 20, 2019, 3:16 a.m.