Browse Source

Nueva versión tabla nmice.

master
marcelcosta 1 year ago
parent
commit
4f2d81ac5a
1 changed files with 1 additions and 28 deletions
  1. +1
    -28
      invivos/app.R

+ 1
- 28
invivos/app.R

@ -374,30 +374,7 @@ server <- function(input, output) {
oneside<-""
table<-analysis$taula
if ("ID.animal" %in% colnames(table)){table<-rename(table, "ID animal"=`ID.animal`)}
if ("ID" %in% colnames(table)){table<-rename(table, "ID animal"=ID)}
if ("ID.tumor" %in% colnames(table)){table<-rename(table, "ID tumor"=`ID.tumor`)}
# table[table$ID.tumor == "R","0"]<-NA
col_nodays<-c("ID","Code", "Cage","Group", "ID.animal","ID animal", "ID.tumor", "ID tumor", "TS","DPV", "Absorbance")
if (length(grep(0, colnames(table)[!colnames(table) %in% col_nodays])) == 0 & input$vacc == "Sí"){
table["0"]<-0
}
table<-melt(table, id=colnames(table)[colnames(table) %in% col_nodays], variable.name = "Timepoint")
table$Timepoint<-gsub("[A-Za-z ]","",table$Timepoint)
# print(table)
if ("DPV" %in% colnames(table)){
table<-dcast(table, Cage+`ID animal`+`ID tumor`+Group+Timepoint~DPV, value.var = "value")
table$Major<-table$Major
table$Minor<-table$Minor
table["Volume"]<-((table$Major*table$Minor*table$Minor)*(pi/6))
}
if ("TS" %in% colnames(table)){
table<-dcast(table, Cage+`ID animal`+`ID tumor`+Group+Timepoint~TS, value.var = "value")
table["Volume"]<-table$`TS-Deep`*table$`TS-Length`*table$`TS-Width`*pi/6
}
if (!"Volume" %in% colnames(table)){table<-rename(table, "Volume"=value)}
table<-table %>% filter(!is.na(Group))
table$Timepoint<-factor(table$Timepoint, levels=mixedsort(as.numeric(as.character(unique(table$Timepoint)))))
if (input$increase_volume){
timepoints<-unique(table$Timepoint)
table<-table %>% select(-Major, -Minor) %>%
@ -406,11 +383,7 @@ server <- function(input, output) {
gather(Timepoint, Volume, -Cage, -`ID animal`, -`ID tumor`, -Group) %>%
mutate(Volume=case_when(Volume < 0 ~ 0, T~Volume))
}
table$Timepoint<-factor(table$Timepoint, levels=mixedsort(as.numeric(as.character(unique(table$Timepoint)))))
analysis$taula_def<-table
analysis$taula_vol<-dcast(table, Cage+`ID animal`+`ID tumor`~Timepoint,value.var = "Volume")
table_plot<-dcast(dcast(table %>% filter(!is.na(Volume)), `ID animal`+Group+Timepoint~., value.var = "Volume", fun.aggregate = mean), Group~Timepoint)
table_plot
table %>% group_by(Group, DayPostInoc, Side) %>% count() %>% spread(DayPostInoc, n)
}
})
output$cin_group<-renderPlot({

Loading…
Cancel
Save