From 18bb3e75f3028e3e09b7f2d0ecb474ce3ea16be1 Mon Sep 17 00:00:00 2001 From: marcelcosta Date: Thu, 12 Jan 2023 15:40:51 +0100 Subject: [PATCH] =?UTF-8?q?1a=20Versi=C3=B3n=20del=20programa.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Nitrogen/app.R | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/Nitrogen/app.R b/Nitrogen/app.R index 202b220..efa2252 100644 --- a/Nitrogen/app.R +++ b/Nitrogen/app.R @@ -1,4 +1,8 @@ library(shiny) +library(readxl) +library(DT) + +file<-"V:/LBM/VIROTERAPIA I TERAPIA GENICA/Lola/Proyecto Idibell UM - Lola/Documentacion ensayo clinico PULSE laboratorio/PULSE MUESTRAS -80.xlsx" ui <- fluidPage( @@ -8,20 +12,50 @@ ui <- fluidPage( # Sidebar sidebarLayout( sidebarPanel( - + fileInput(inputId = "excel", label = "Cargar Cajas", multiple = F) ), mainPanel( - + DTOutput("DT_ab") ) ) ) server <- function(input, output) { - - output$distPlot <- renderPlot({ - }) + nitro<-reactiveValues() + nitro$db<-NULL + + observe({ + if (!is.null(input$excel)){ + sheets<-excel_sheets(input$excel$datapath) + + table<-read_xlsx(input$excel$datapath, sheet = 1) %>% + add_column("Caja"=sheets[1]) %>% + gather(Columna, Vial, -1, -Caja) %>% + rename("Fila"="...1") + + if (length(sheets) > 1){ + for (i in 2:length(sheets)){ + table<-rbind( + table, + read_xlsx(input$excel$datapath, sheet = i) %>% + add_column("Caja"=sheets[i]) %>% + gather(Columna, Vial, -1, -Caja) %>% + rename("Fila"="...1") + ) + } + } + + table<-table[,c("Caja","Fila","Columna","Vial")] + nitro$db<-table + } + }) + + output$DT_ab <- renderDT({ + table<-nitro$db + datatable(table, filter = "bottom", rownames = F, escape = F, extensions='Buttons',options = list(autoWidth=TRUE, dom = 'Bfrtip',buttons=I('colvis'), lengthMenu=c(10,20,50), pageLength=20, columnDefs=list(list("visible"=F,"targets"=match("Etiqueta",colnames(table))-1)))) + }) } # Run the application