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(
|
|
|
|
# Application title
|
|
titlePanel("Old Faithful Geyser Data"),
|
|
|
|
# Sidebar
|
|
sidebarLayout(
|
|
sidebarPanel(
|
|
fileInput(inputId = "excel", label = "Cargar Cajas", multiple = F)
|
|
),
|
|
|
|
|
|
mainPanel(
|
|
DTOutput("DT_ab")
|
|
)
|
|
)
|
|
)
|
|
|
|
server <- function(input, output) {
|
|
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
|
|
shinyApp(ui = ui, server = server)
|