From 549a963928d17c1f817eee4249a3f579c778b961 Mon Sep 17 00:00:00 2001 From: marcelcosta Date: Fri, 23 Sep 2022 12:13:46 +0200 Subject: [PATCH] =?UTF-8?q?Incorporar=20la=20opci=C3=B3n=20de=20mostrar=20?= =?UTF-8?q?incremento=20de=20volumen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- invivos/app.R | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/invivos/app.R b/invivos/app.R index 9f13173..be62d26 100755 --- a/invivos/app.R +++ b/invivos/app.R @@ -42,6 +42,7 @@ ui <- fluidPage( selectInput(inputId = "vacc", "Experimento de Vacunación", selected = "No", choices = c("Sí","No")), uiOutput('cutoffUI'), checkboxInput("filter_stats","Filtrar Estadística"), + checkboxInput("increase_volume","Usar Incremento de Volumen"), downloadButton("downloadVolume", "Descargar Volúmenes") ), mainPanel( @@ -380,6 +381,15 @@ server <- function(input, output) { if (!"Volume" %in% colnames(table)){table<-rename(table, "Volume"=value)} table<-table %>% filter(!is.na(Group)) table$Timepoint<-factor(table$Timepoint, levels=mixedsort(as.numeric(as.character(unique(table$Timepoint))))) + if (input$increase_volume){ + timepoints<-unique(table$Timepoint) + table<-table %>% select(-Major, -Minor) %>% + spread(Timepoint, Volume) %>% + mutate(across(all_of(timepoints), function(x){(x*100/`0`)-100})) %>% + gather(Timepoint, Volume, -Cage, -`ID animal`, -`ID tumor`, -Group) %>% + mutate(Volume=case_when(Volume < 0 ~ 0, T~Volume)) + } + table$Timepoint<-factor(table$Timepoint, levels=mixedsort(as.numeric(as.character(unique(table$Timepoint))))) analysis$taula_def<-table analysis$taula_vol<-dcast(table, Cage+`ID animal`+`ID tumor`~Timepoint,value.var = "Volume") table_plot<-dcast(dcast(table %>% filter(!is.na(Volume)), `ID animal`+Group+Timepoint~., value.var = "Volume", fun.aggregate = mean), Group~Timepoint) @@ -390,6 +400,7 @@ server <- function(input, output) { if (!is.null(input$file_analy) & !is.null(analysis$taula_def)){ observeEvent(analysis$taula_def, {}) table<-analysis$taula_def + if (input$vacc == "Sí"){ ggplot(table, aes(as.numeric(as.character(Timepoint)), Volume, color=Group, group=Group))+ geom_errorbar(stat="summary", width=0.05)+