Entering edit mode
3 months ago
G.S
▴
60
Hello,
I would like to add stats to this plot. Any help would be much appreciated and thanks in advance
Here is my code:
data4.ts%>% ungroup() %>% t.test(data =.,value ~ Condition) %>%
adjust_pvalue(method = "bonferroni")
data2.ts %>% ungroup() %>% t.test(data =.,value ~ Condition) %>%
adjust_pvalue(method = "bonferroni")
a %>%
filter(name == "norm_CntTs",
!is.na(coding)) %>%
ggplot(aes(x = Condition, y = value, color = Condition))+
geom_boxplot(width = 0.5,
show.legend = FALSE)+
scale_y_log10()+
scale_color_manual(
values = c(
"HRSV" = "#eb4a40",
"HRSV_RBV" = "#045275"
)
)+
facet_wrap(.~coding,ncol = 1)
+
labs(
title = "Ts",
y = "Average Ts count"
)+
theme_bw()+
theme(
text = element_text(size = 12),
plot.title = element_text(hjust = 0.5),
#strip.background = element_rect(color =)
strip.text = element_text(face = "bold")
)
Hi, you can add statistical annotations using
ggpubr
functionstat_pvalue_manual
. You need to make sure you calculate the p-values first and then use the stat_pvalue_manual function to add these values to the plot. For example:Check the code
Thanks. That helpful.
I am getting this error
Please use
101010
to formatcode
so it is represented in monospace font. I have done this for you now.I think this is what caused the error. we do not have group 1 and 2 in the statistical test results????
The error is likely due to the fact that the structure of your data in data4.ts and data2.ts may not contain the Condition values. The group1 and group2 columns are added based on this. The Condition column should be a factor or a categorical variable that distinguishes between the groups you are comparing. Could you show me data4.ts and data2.ts?
Thanks, thats really helpful
Thank you, it seems to be clearer. Your Condition already has two factorial levels. You can replace these names in groups 1 and 2.
Try and let me know
if don't work try binding the stats without group.
the other parts of the code remain the same. I hope this work, let me know.
Thanks for the help. Unfortunately, did not work :(
error in asserttat_group_columns_exists(data) : data should contain group1 and group2 columns