From 0f4791f814098d9a05342cae74d3cd7b5c7b92f8 Mon Sep 17 00:00:00 2001 From: Costa <47926492N@ICO.SCS.local> Date: Wed, 4 Nov 2020 12:46:30 +0100 Subject: [PATCH] "correct template" --- invivos/app.R | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/invivos/app.R b/invivos/app.R index 8744ca3..896f36f 100755 --- a/invivos/app.R +++ b/invivos/app.R @@ -178,10 +178,15 @@ server <- function(input, output) { dtemplate<-dcast(template, MouseID+group+DPV~Timepoint) dtemplate<-dtemplate[mixedorder(as.character(dtemplate$MouseID)),] } - dtemplate[,4:ncol(dtemplate)]<-"" + dtemplate<-dtemplate %>% add_column(.after="MouseID", "ID tumor"=dtemplate$MouseID)%>% rename(`ID animal`=MouseID) + dtemplate["ID tumor"]<-gsub("[[:digit:]]","",dtemplate$`ID tumor`) + dtemplate["ID animal"]<-gsub("[LR]","",dtemplate$`ID animal`) + dtemplate[,5:ncol(dtemplate)]<-"" }else{ - template<-expand.grid(LETTERS[1:ncages], 1:5, id_tumors, timepoint) - colnames(template)<-c("Cage", "ID animal", "ID tumor", "Timepoint") + template<-expand.grid(LETTERS[1:ncages], 1:5, id_tumors, timepoint)[,-2] + colnames(template)<-c("Cage", "ID tumor", "Timepoint") + nids<-length(id_tumors)*length(timepoint) + template[order(template$Cage),"ID animal"]<-rep(1:(nrow(template)/(nids)), each=nids) template<-template[order(template$Timepoint, template$Cage, template$`ID animal`),] template["Group"]<-"" if (input$measure_sys == "L-W-D"){