Añadir aplicación
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
library(shiny)
|
||||||
|
|
||||||
|
# Define UI for application
|
||||||
|
ui <- fluidPage(
|
||||||
|
|
||||||
|
#Navbar
|
||||||
|
navbarPage("Seguimiento in vivos",
|
||||||
|
tabPanel("Diseño",
|
||||||
|
sidebarPanel(
|
||||||
|
fileInput(inputId = "file_sizes", label = "Hoja de tamaños", multiple = F),
|
||||||
|
sliderInput("ncages", "Cajas", min=1, max=10, value=1),
|
||||||
|
downloadButton("downloadData", "Descargar Excel")
|
||||||
|
)
|
||||||
|
),
|
||||||
|
tabPanel("Análisis")
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
# Define server logic required to draw a histogram
|
||||||
|
server <- function(input, output) {
|
||||||
|
output$downloadData <- downloadHandler(
|
||||||
|
|
||||||
|
filename = function() {
|
||||||
|
paste("invivo", ".xlsx", sep="")
|
||||||
|
},
|
||||||
|
content = function(file){
|
||||||
|
ncages<-input$ncages
|
||||||
|
nrat_cage<-5
|
||||||
|
id_tumors<-c("L","R")
|
||||||
|
timepoint<-c(7,10,13,16,19,22,25)
|
||||||
|
|
||||||
|
|
||||||
|
template<-expand.grid(LETTERS[1:ncages], 1:5, id_tumors, timepoint)
|
||||||
|
colnames(template)<-c("Cage", "ID animal", "ID tumor", "Timepoint")
|
||||||
|
template<-template[order(template$Timepoint, template$Cage, template$`ID animal`),]
|
||||||
|
template["Group"]<-""
|
||||||
|
template<-rbind(template, template, template)
|
||||||
|
template<-template[order(template$Timepoint, template$Cage, template$`ID animal`, template$`ID tumor`),]
|
||||||
|
template["TS"]<-rep(c("TS-Length", "TS-Width", "TS-Deep"), nrow(template)/3)
|
||||||
|
dtemplate<-dcast(template, Cage+`ID animal`+`ID tumor`+Group+TS~Timepoint)
|
||||||
|
dtemplate[,6:ncol(dtemplate)]<-""
|
||||||
|
|
||||||
|
write.xlsx(dtemplate,file)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run the application
|
||||||
|
shinyApp(ui = ui, server = server)
|
||||||
|
|
||||||
Reference in New Issue
Block a user