how to solve "Error in comp[[i]] : subscript out of bounds" to make compact letter display in two ways Anova using R studio?

I have a problem with "Error in comp[[i]] : subscript out of bounds"
image

I want to indicate compact letter display in my analysis but it did not work. I have tried to find some solution in the internet but it failed.
Could anyone help me?
this is my data

and this is the script

library(datasets)
library(ggplot2)
library(multcompView)
library(dplyr)
library(datasets)
library(tidyverse)
library(multcomp)

Data = read.csv("data.csv", h= TRUE)
qplot(x = species, y = Ratio, geom = "point", data = Data) +
  facet_grid(.~Strain)


# creating a variable as factor for the ANOVA
Data$Strain <- as.factor(Data$Strain)
Data$species <- as.factor(Data$species)
str(Data)

# analysis of variance
anova <- aov(Ratio ~ Strain*factor(species), data = Data)
summary(anova)

# table with factors, means and standard deviation
data_summary <- group_by(Data, Strain, species) %>%
  summarise(mean=mean(Ratio), sd=sd(Ratio)) %>%
  arrange(desc(mean))
print(data_summary)

# Tukey's test
tukey <- TukeyHSD(anova)
print(tukey)


# compact letter display
coba = multcompLetters4(anova, tukey)
print(coba)

# creating the compact letter display
tukey.cld <- multcompLetters4(anova, tukey)
print(tukey.cld)

It will be easier for me if I can distinguish the significant of data based on the letters.
I really need help here as soon as possible.
please help

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.