Correct for more than 1 facet.

This commit is contained in:
2025-03-06 13:46:43 +01:00
parent ab96f5ec6a
commit 217bca2480
+4 -4
View File
@@ -70,11 +70,11 @@ ggstats_add_xy<-function(table_stat, table, xcol=NULL, group, y="max", bracket.o
} }
} }
}else{ }else{
for (dia in unique(pull(table_stat,all_of(exclude_group)))){ for (dia in unique(pull(mutate(table_stat,dia=paste0(!!!syms(exclude_group))),dia))){
t[table_stat[,exclude_group] == dia, "y.position"]<-seq(t[table_stat[,exclude_group] == dia,"y.position"][[1,1]], t[apply(table_stat[,exclude_group], 1, paste, collapse="") == dia, "y.position"]<-seq(t[apply(table_stat[,exclude_group], 1, paste, collapse="") == dia,"y.position"][[1,1]],
t[table_stat[,exclude_group] == dia,"y.position"][[1,1]]+ t[apply(table_stat[,exclude_group], 1, paste, collapse="") == dia,"y.position"][[1,1]]+
diff(range(table[,value.var], na.rm = T))* diff(range(table[,value.var], na.rm = T))*
bracket.inspace*(nrow(table_stat[table_stat[,exclude_group] == dia,])-1), bracket.inspace*(nrow(table_stat[apply(table_stat[,exclude_group], 1, paste, collapse="") == dia,])-1),
by=diff(range(table[,value.var], na.rm = T))*bracket.inspace) by=diff(range(table[,value.var], na.rm = T))*bracket.inspace)
} }
} }