R/descargar_cuadros.R

# NOTA: No modifique esta seccion todavia porque tengo que ver que conviene.

#### Logica de descarga de bases ####
# DescargarEstimacion <- reactive({
#   estimacion = NULL
#
#   if (input$DescEstim == "prop") {
#     estimacion = estim_categ()
#     nombres = sapply(estimacion, function(x) x[1, "Var_Analisis"])
#     names(estimacion) = nombres
#   }
#
#   if (input$DescEstim == "media") {
#     estimacion = estim_media()
#     names(estimacion) = input$VarCont2
#   }
#
#   if (input$DescEstim == "total") {
#     estimacion = estim_total()
#     if (substr(input$EncuestaSelect, 1, nchar("ENGHo Gastos")) != "ENGHo Gastos" &&
#        input$EncuestaSelect != "ENGHo Otros Gastos") {
#       names(estimacion) = input$VarCont
#     }
#   }
#
#   if (input$DescEstim == "razon") {
#     estimacion = estim_razon()
#     if (substr(input$EncuestaSelect, 1, nchar("ENGHo Gastos")) != "ENGHo Gastos" &&
#        input$EncuestaSelect != "ENGHo Otros Gastos") {
#       names(estimacion) = paste0(input$VarNum, "_", input$VarDen)
#     }
#   }
#   return(estimacion)
# })

# output$downloadEstim <- downloadHandler(
#
#   #filename pega el nombre con el que se va a descargar el archivo a la extension elegida
#   filename = function() {
#     if (input$Ext2 == "xlsx") {ext = ".xlsx"}
#     if (input$Ext2 == "RDS")  {ext = ".RDS"}
#
#     nomb = NULL
#     if(input$DescEstim=="prop")  {nomb = "Estimacion_Proporcion"}
#     if(input$DescEstim=="media") {nomb = "Estimacion_Media"}
#     if(input$DescEstim=="total") {nomb = "Estimacion_Total"}
#     if(input$DescEstim=="razon") {nomb = "Estimacion_Razon"}
#
#     return(paste0(nomb, ext))
#   },
#
#   #content ejecuta el write. correspondiente para guardar la base
#   content = function(file) {
#
#     if (input$Ext2 == "RDS")  {saveRDS(DescargarEstimacion(), file)}
#     if (input$Ext2 == "xlsx") {openxlsx::write.xlsx(DescargarEstimacion(), file)}
#   }
# )
tomicapretto/cemrepboot documentation built on Dec. 31, 2020, 8:43 a.m.