-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.R
32 lines (29 loc) · 1.01 KB
/
server.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
if(!packrat:::isPackratModeOn()) packrat::on()
library(dplyr)
d <- readRDS("./data/demographics_df.rds")
source("./functions/calculate_probabilities.R")
call_compile <- function(e, t, ...){
argumentos <- list(...)
argumentos <- argumentos [unlist(lapply(argumentos, function(x) x != ""))]
filtrado <- do.call(filtering, c(list(e = e, t = t), argumentos))
compile(filtrado) %>%
select(candidato, tot)
}
# Define server logic required to draw a histogram
server <- function(input, output) {
output$candidate_rank <- renderTable({
call_compile(d$demographics, d$totals,
region = input$i_region,
zona = input$i_zona,
edad = input$i_edad,
partido = input$i_partido,
consulta = input$i_consulta,
estrato = input$i_estrato,
genero = input$i_genero)
})
output$buttons_out <- renderPrint(list(
a = input$i_genero_masculino,
b = input$i_genero_femenino,
c = input$i_zona_urbano
))
}