kyliec
kyliec

Reputation: 21

PERMANOVA code error message "Error in XX %*% SCEC : non-conformable arguments"

I have data that encompasses 2 different species, 4 treatments, and 9 variables.

I am trying to run a PERMANOVA using the example code from the R code sheet from CRAN. here is what i am referencing: https://cran.r-project.org/web/packages/PERMANOVA/PERMANOVA.pdf

And I am getting this error message: "Error in XX %*% SCEC : non-conformable arguments"

And here is my code:

df= na.omit(all_data)
df$Treatment= as.factor(df$Treatment)
df$Species = as.factor(df$Species)
head(df)
colnames(df)

X = df[,3:10]
#View(X)
X=IniTransform(X)
D = DistContinuous (X)
permanova=PERMANOVA(D, df$Treatment)
permanova
C = matrix(c(1, 0,  0,  0,
0, 1,  0,  0,
0, 0,  1,  0,
0, 0,  0,  1), nrow=4, byrow=TRUE)
rownames(C)=c("C1", "C2", "C3",'C4')
colnames(C)=levels(df$Treatment)
effects=factor(c(1,2,3,4,5,6,7,8,9))
levels(effects)=c("Species", "pH", "Salinity", 
'Amonium', 'Photosynthesis_Rate', 
'Redox_Potential', 'Sulfide',
'Aboveground_Biomass','Belowground_Biomass')
permanova2=PERMANOVA(D, df$Treatment, C=C, Effects=effects, CoordPrinc = TRUE)
summary(permanova2)

I keep getting the error: "Error in XX %*% SCEC : non-conformable arguments" when i run the second to last line.

What do you think is wrong with my code/line?

thank you

Upvotes: 1

Views: 35

Answers (0)

Related Questions