Añadido compatibilidad formato virus.
This commit is contained in:
+45
-1
@@ -32,12 +32,17 @@ ui <- fluidPage(
|
|||||||
server <- function(input, output) {
|
server <- function(input, output) {
|
||||||
dades<-reactiveValues()
|
dades<-reactiveValues()
|
||||||
dades$taula<-NULL
|
dades$taula<-NULL
|
||||||
|
dades$type<-NULL
|
||||||
|
|
||||||
## Listado ----
|
## Listado ----
|
||||||
|
|
||||||
observe({
|
observe({
|
||||||
req(input$file)
|
req(input$file)
|
||||||
df.list<-lapply(excel_sheets(input$file$datapath), read_xlsx, path=input$file$datapath, range="B1:K31", col_type="text")
|
if(read_xlsx(input$file$datapath, sheet = 1, range="B1:B1", col_names = F) == "1"){dades$type<-"ICO"}else{dades$type<-"Virus"}
|
||||||
|
|
||||||
|
if(dades$type == "ICO"){
|
||||||
|
df.list<-lapply(excel_sheets(input$file$datapath), read_xlsx,
|
||||||
|
path=input$file$datapath, range="B2:K31", col_type="text", col_names=F)
|
||||||
names(df.list)<-excel_sheets(input$file$datapath)
|
names(df.list)<-excel_sheets(input$file$datapath)
|
||||||
name.row<-seq(from=1, to=nrow(df.list[[1]]), by=3)
|
name.row<-seq(from=1, to=nrow(df.list[[1]]), by=3)
|
||||||
date.row<-seq(from=2, to=nrow(df.list[[1]]), by=3)
|
date.row<-seq(from=2, to=nrow(df.list[[1]]), by=3)
|
||||||
@@ -60,6 +65,33 @@ server <- function(input, output) {
|
|||||||
df[,i]<-factor(df[,i])
|
df[,i]<-factor(df[,i])
|
||||||
}
|
}
|
||||||
dades$taula<-df
|
dades$taula<-df
|
||||||
|
}
|
||||||
|
if(dades$type == "Virus"){
|
||||||
|
df.list<-lapply(excel_sheets(input$file$datapath), read_xlsx,
|
||||||
|
path=input$file$datapath, range="A1:J30", col_type="text", col_names=F)
|
||||||
|
names(df.list)<-excel_sheets(input$file$datapath)
|
||||||
|
name.row<-seq(from=1, to=nrow(df.list[[1]]), by=3)
|
||||||
|
date.row<-seq(from=2, to=nrow(df.list[[1]]), by=3)
|
||||||
|
desc.row<-seq(from=3, to=nrow(df.list[[1]]), by=3)
|
||||||
|
for (i in 1:length(df.list)){
|
||||||
|
df.list[[i]]<-data.frame(
|
||||||
|
Tanque=gsub("-[0-9]* #[0-9]*$","",names(df.list)[i]),
|
||||||
|
Rack=gsub("^[A-Z]-| #[0-9]*$","",names(df.list)[i]),
|
||||||
|
Caja=names(df.list)[i],
|
||||||
|
`Posición`=factor(as.character(1:100),levels=as.character(1:100)),
|
||||||
|
Cell.Line=unlist(df.list[[i]][name.row,]),
|
||||||
|
`Descongelación`=unlist(df.list[[i]][date.row,]),
|
||||||
|
Passage=unlist(df.list[[i]][desc.row,])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
df<-do.call(rbind, df.list)
|
||||||
|
df[grepl("^[0-9]*$", df$Passage),"Passage"]<-as.character(as.Date(as.numeric(df[grepl("^[0-9]*$", df$Passage),"Passage"]), origin = "1899-12-30"))
|
||||||
|
for (i in c("Tanque", "Rack","Caja")){
|
||||||
|
df[,i]<-factor(df[,i])
|
||||||
|
}
|
||||||
|
dades$taula<-df
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
output$DT <- renderDT({
|
output$DT <- renderDT({
|
||||||
@@ -76,6 +108,7 @@ server <- function(input, output) {
|
|||||||
|
|
||||||
output$DT_caja <- renderTable({
|
output$DT_caja <- renderTable({
|
||||||
req(dades$taula)
|
req(dades$taula)
|
||||||
|
if(dades$type == "ICO"){
|
||||||
caja_l<-dades$taula[dades$taula$Caja == input$caja,]
|
caja_l<-dades$taula[dades$taula$Caja == input$caja,]
|
||||||
caja_l$Nombre[is.na(caja_l$Nombre)]<-""
|
caja_l$Nombre[is.na(caja_l$Nombre)]<-""
|
||||||
caja_l$Fecha[is.na(caja_l$Fecha)]<-""
|
caja_l$Fecha[is.na(caja_l$Fecha)]<-""
|
||||||
@@ -84,6 +117,17 @@ server <- function(input, output) {
|
|||||||
ncol = 10, nrow=10))
|
ncol = 10, nrow=10))
|
||||||
colnames(caja)<-as.character(1:10)
|
colnames(caja)<-as.character(1:10)
|
||||||
rownames(caja)<-LETTERS[1:10]
|
rownames(caja)<-LETTERS[1:10]
|
||||||
|
}
|
||||||
|
if(dades$type == "Virus"){
|
||||||
|
caja_l<-dades$taula[dades$taula$Caja == input$caja,]
|
||||||
|
caja_l$Cell.Line[is.na(caja_l$Cell.Line)]<-""
|
||||||
|
caja_l$`Descongelación`[is.na(caja_l$`Descongelación`)]<-""
|
||||||
|
caja_l$Passage[is.na(caja_l$Passage)]<-""
|
||||||
|
caja<-as.data.frame(matrix(data= paste(caja_l$Cell.Line, caja_l$`Descongelación`, caja_l$Passage, sep="<br>"),
|
||||||
|
ncol = 10, nrow=10))
|
||||||
|
colnames(caja)<-NULL
|
||||||
|
rownames(caja)<-NULL
|
||||||
|
}
|
||||||
|
|
||||||
caja
|
caja
|
||||||
}, rownames = TRUE, sanitize.text.function=identity, bordered = TRUE)
|
}, rownames = TRUE, sanitize.text.function=identity, bordered = TRUE)
|
||||||
|
|||||||
Reference in New Issue
Block a user