Skip to content

Commit d62285c

Browse files
committed
add option to download csv file of all projections #54 #57
1 parent c9ddf85 commit d62285c

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

R/app_server.R

+33-1
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,26 @@ app_server <- function( input, output, session ) {
470470
)
471471
})
472472

473+
raw.table <- eventReactive(input$go, {
474+
traj_list_to_df(x = switch(input$crad,
475+
"n_yr" = {
476+
list(
477+
high.list.const(),
478+
med.list.const(),
479+
low.list.const(),
480+
zero.list.const()
481+
)
482+
},
483+
"rate2" = {
484+
list(
485+
high.list.rate(),
486+
med.list.rate(),
487+
low.list.rate(),
488+
zero.list.rate()
489+
)
490+
}
491+
))
492+
})
473493
# Observe() values --------------------------------------------------------
474494

475495

@@ -1103,6 +1123,15 @@ app_server <- function( input, output, session ) {
11031123
}
11041124
) #/ downloadHandler
11051125

1126+
1127+
# DOWNLOAD RAW RESULTS ----------------------------------------------------
1128+
output$rawouts <- downloadHandler(
1129+
filename = paste("projoutput-", Sys.Date(), ".csv", sep=""),
1130+
content = function(file) {
1131+
write.csv(raw.table(), file)
1132+
}
1133+
) #/ downloadHandler
1134+
11061135

11071136
# DOCUMENTATION -----------------------------------------------------------
11081137
dpath <- reactive(app_sys("Documentation",
@@ -1502,7 +1531,10 @@ app_server <- function( input, output, session ) {
15021531
p(i18n$t("Would you like to download a report of your inputs and outputs? The button below will write an html file that you can save and share.")),
15031532
br(),
15041533
p(i18n$t("Make sure you have clicked"), em(i18n$t("Run Projections."))),
1505-
downloadButton(outputId = "report", i18n$t("Generate report"))
1534+
downloadButton(outputId = "report",
1535+
i18n$t("Generate report")),
1536+
downloadButton(outputId = "rawouts",
1537+
"Download raw projections")
15061538
), # end PBR tab
15071539
tabPanel(
15081540
i18n$t("Solve for Bycatch"),

inst/Documentation/translation_maritza.json

+5
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,11 @@
512512
"es": "Generar reporte",
513513
"fr": "Générer un rapport"
514514
},
515+
{
516+
"en": "Download raw projections",
517+
"es": "Descargar proyecciones",
518+
"fr": "Télécharger les projections"
519+
},
515520
{
516521
"en": "Solve for Bycatch",
517522
"es": "Resolver para captura incidental",

0 commit comments

Comments
 (0)