Adaptación de tabla de estadística al nuevo formato.
This commit is contained in:
+14
-14
@@ -564,42 +564,42 @@ server <- function(input, output) {
|
||||
output$tab_stats<-renderTable({
|
||||
stattest<-"dunn"
|
||||
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()
|
||||
if (input$vacc == "No"){
|
||||
table<-table%>%filter(!is.na(Volume))
|
||||
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))
|
||||
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){
|
||||
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)
|
||||
|
||||
}else{
|
||||
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){
|
||||
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))
|
||||
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){
|
||||
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_def<-bind_rows(table_stats, .id = "ID tumor")
|
||||
table_stats_def<-bind_rows(table_stats, .id = "Side")
|
||||
if (input$filter_stats == T){
|
||||
table_stats_def %>% filter(p.adj < 0.05)
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user