I am performing a redundancy analysis in RStudio. My data includes several environmental variables as the community data matrix, and a GROUP column, which is the constraining matrix. For example:
CONDUCTIVITY pH GROUP
453 7.5 A
462 7.7 A
500 8.1 B
525 8.0 B
308 8.4 C
306 8.5 C
I am doing a redundancy analysis to compare the environmental variables between groups (which represent locations), such as, is the conductivity in group A significantly different than the conductivity in group B. My R script is as follows:
df <- read.csv("All_data_long_format.csv")
library(vegan)
rda <- rda(df[,2:9] ~ df$GROUP) # columns 2 to 9 are the environmental variables
I get the error:
Error in terms.formula(formula,"Condition",data=data): 'data' argument is of the wrong type.
I'm not sure what this means, but my guess is 'df' is the wrong type, but I'm not sure why or how to solve it.