Browse Source

Adaptación de tabla de estadística al nuevo formato.

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

+ 14
- 14
invivos/app.R

@ -564,42 +564,42 @@ server <- function(input, output) {
output$tab_stats<-renderTable({ output$tab_stats<-renderTable({
stattest<-"dunn" stattest<-"dunn"
oneside<-"" oneside<-""
if (!is.null(input$file_analy) & !is.null(analysis$taula_def)){
table<-analysis$taula_def
if (!is.null(input$file_analy) & !is.null(analysis$taula)){
table<-analysis$taula
table_stats<-list() table_stats<-list()
if (input$vacc == "No"){ if (input$vacc == "No"){
table<-table%>%filter(!is.na(Volume)) table<-table%>%filter(!is.na(Volume))
if (length(unique(table$Volume)) > 1){ if (length(unique(table$Volume)) > 1){
table_stats<-multi_stats(table, "Volume", "Timepoint", "Group", stat.test=stattest)
table_stats<-multi_stats(table, "Volume", "DayPostInoc", "Group", stat.test=stattest)
} }
table_kw<-as.data.frame(matrix(nrow=0, ncol=2)) table_kw<-as.data.frame(matrix(nrow=0, ncol=2))
for (point in unique(table$Timepoint)){
len_group<-length(unique(table %>% filter(Timepoint == point) %>% pull(Group)))
for (point in unique(table$DayPostInoc)){
len_group<-length(unique(table %>% filter(DayPostInoc == point) %>% pull(Group)))
if (len_group > 1){ if (len_group > 1){
table_kw<-rbind(table_kw, data.frame(point,kruskal.test(table %>% filter(Timepoint == point) %>% pull(Volume), table %>% filter(Timepoint == point) %>% pull(Group))[3][[1]]))
table_kw<-rbind(table_kw, data.frame(point,kruskal.test(table %>% filter(DayPostInoc == point) %>% pull(Volume), table %>% filter(DayPostInoc == point) %>% pull(Group))[3][[1]]))
} }
} }
colnames(table_kw)<-c("Timepoint", "KW-p.val")
colnames(table_kw)<-c("DayPostInoc", "KW-p.val")
table_stats<-merge(table_stats, table_kw) table_stats<-merge(table_stats, table_kw)
}else{ }else{
for (side in c("L","R")){ for (side in c("L","R")){
tableR<-filter(table, `ID tumor` == side) %>% filter(!is.na(Volume))
tableR<-filter(table, Side == side) %>% filter(!is.na(Volume))
if (length(unique(tableR$Volume)) > 1){ if (length(unique(tableR$Volume)) > 1){
table_stats[[side]]<-multi_stats(tableR, "Volume", "Timepoint", "Group", stat.test=stattest)
table_stats[[side]]<-multi_stats(tableR, "Volume", "DayPostInoc", "Group", stat.test=stattest)
} }
table_kw<-as.data.frame(matrix(nrow=0, ncol=2)) table_kw<-as.data.frame(matrix(nrow=0, ncol=2))
for (point in unique(tableR$Timepoint)){
len_group<-length(unique(tableR %>% filter(Timepoint == point) %>% pull(Group)))
for (point in unique(tableR$DayPostInoc)){
len_group<-length(unique(tableR %>% filter(DayPostInoc == point) %>% pull(Group)))
if (len_group > 1){ if (len_group > 1){
table_kw<-rbind(table_kw, data.frame(point,kruskal.test(tableR %>% filter(Timepoint == point) %>% pull(Volume), tableR %>% filter(Timepoint == point) %>% pull(Group))[3][[1]]))
table_kw<-rbind(table_kw, data.frame(point,kruskal.test(tableR %>% filter(DayPostInoc == point) %>% pull(Volume), tableR %>% filter(DayPostInoc == point) %>% pull(Group))[3][[1]]))
} }
} }
colnames(table_kw)<-c("Timepoint", "KW-p.val")
colnames(table_kw)<-c("DayPostInoc", "KW-p.val")
table_stats[[side]]<-merge(table_stats[[side]], table_kw) table_stats[[side]]<-merge(table_stats[[side]], table_kw)
} }
} }
table_stats_def<-bind_rows(table_stats, .id = "ID tumor")
table_stats_def<-bind_rows(table_stats, .id = "Side")
if (input$filter_stats == T){ if (input$filter_stats == T){
table_stats_def %>% filter(p.adj < 0.05) table_stats_def %>% filter(p.adj < 0.05)
}else{ }else{

Loading…
Cancel
Save