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"){