From becfb0a25b5541c669e5ee8db64c7fda2d3080ee Mon Sep 17 00:00:00 2001 From: nfrerebeau Date: Mon, 21 Oct 2024 18:44:41 +0200 Subject: [PATCH] Follow changes in dimensio --- R/multivariate.R | 7 ++++++- R/pca.R | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/R/multivariate.R b/R/multivariate.R index b827baa..de84d35 100644 --- a/R/multivariate.R +++ b/R/multivariate.R @@ -264,7 +264,12 @@ multivariate_server <- function(id, x) { function(...) invisible() ) - fun_wrap(x = x(), margin = 1, axes = c(axis1(), axis2())) + fun_wrap( + x = x(), + margin = 1, + axes = c(axis1(), axis2()), + color = khroma::color(input$col_ind) + ) grDevices::recordPlot() }) diff --git a/R/pca.R b/R/pca.R index 65e28b3..9d6d5aa 100644 --- a/R/pca.R +++ b/R/pca.R @@ -42,7 +42,12 @@ pca_ui <- function(id, center = TRUE, scale = TRUE) { ), actionButton( inputId = ns("go"), - label = "(Re)Compute" + label = "(Re)Compute", + class = "btn btn-primary" + ), + downloadButton( + outputId = ns("download"), + label = "Download results" ) ), # sidebar multivariate_ui(id), @@ -85,7 +90,7 @@ pca_server <- function(id, x) { i }) sup_col <- reactive({ - i <- match(input$sup_row, colnames(x())) + i <- match(input$sup_col, colnames(x())) if (anyNA(i)) return(NULL) i }) @@ -107,6 +112,15 @@ pca_server <- function(id, x) { input$go ) + ## Export ----- + output$download <- downloadHandler( + filename = function() { make_file_name("pca", "zip") }, + content = function(file) { + dimensio::export(results(), file = file, flags = "-r9Xj") + }, + contentType = "application/zip" + ) + results }) }