Having issues adding significance asterisks to my graphs

31 views Asked by At

I'm very new to R, and I am making a graph for a poster that I have to present, but I am having difficulties adding asterisks to signify significance between my groups.

I keep getting this error:

Warning: [38;5;232mRemoved 512 rows containing non-finite values (stat_summary()).[39m Warning: [38;5;232mRemoved 512 rows containing non-finite values (stat_signif()).[39m Warning: [38;5;232mComputation failed in stat_signif()[39m

I am not sure what I am doing wrong. This is the code that I have been trying to figure out.

eye_data_subset <- eye_data2 %>%
  filter(Fixation_by_trial %in% c("FixationCount_1", "FixationCount_4"))
  desired_group_order <- c("YA", "Healthy OA", "MCI")

eye_data_subset$Group <- factor(eye_data_subset$Group, levels = desired_group_order)

ggplot(eye_data_subset, aes(x = Fixation_by_trial, y = Eye_Fixation_Count_Total, fill = Group)) +
  geom_bar(stat = "summary", fun = "mean", position = "dodge", width = 0.5) + 
  ylim(0, 15) +
  geom_signif(comparisons = list(c("YA", "Healthy OA"), c("YA", "MCI"), c("Healthy OA", "MCI")), 
            annotations = "***", y_position = 14, tip_length = 0.2, vjust = 0.5) +
  labs(title = "Fixation Bias for Visual Conditions With Interference vs No Interference", x = "Visual Conditions", y = "Mean Fixation (ms)") +
  theme_minimal() +
  scale_x_discrete(labels = c("FixationCount_1" = "V+C+, V-C+", "FixationCount_4" = "V+C-, V-C-")) +
  scale_fill_manual(values = c("YA" = "maroon", "Healthy OA" = "gold", "MCI" ="gray"))

I would love if someone can help me troubleshoot my code.

I've tried different functions in ggplot, but nothing seems to be helping me.

0

There are 0 answers