I know that this question has been asked previously, but none the answers given have solved my problem.
I keep getting the error message
"Error in unique.default(x, nmax = nmax) : unique() applies only to vectors" in RStudio when I'm trying to compute an ANOSIM.
I'm performing the ANOSIM on a datasheet that contains an Event ID tag, species % coverage data, UTM coordinates, and several data on heavy metal concentrations, salinity and pH. I've attached a sample shot of my data --> Data example
Here are some of the data (sorry for the code block, but it didn't align proplery any other way):
EventID P1  P2  H       N(%)    Cu(ug/g) Mn(ug/g)
T1P0S1  0   100 0       0.0098  12.8     73.1
T1P0S2  10  90  0.1412  0.0084  11.6     95
T1P0S3  5   95  0.0862  0.0042  24.8     138.5
T1P0S4  40  60  0.2923  0.007   28.3     126.8
T1P0S5  15  85  0.1836  0.0042  25.8     137.1
T1P50S1 100 0   0       0.0056  8.2      73.2
T1P50S2 0   100 0       0.0042  6        110.6
T1P50S3 40  60  0.2923  0.0056  0        99.7
T1P50S4 5   95  0.0862  0.0028  32.8     208.3
T1P50S5 55  45  0.2988  0.0042  15.5     140
This is my code:
library(vegan)
library(robustHD)
mydata <- read.csv2("C:/Users/cathr/OneDrive/Dokumenter/KU/Kandidat/Thesis/Stat/veg.csv", header = TRUE, sep= ";",dec = ".")
myData <- mydata[1:85,]
rownames(myData) <- myData$EventID
myData <- myData[,-1]
apply(myData, 1, sum)
mydata[1:47] <- lapply(mydata[1:47], as.numeric)
standardize(mydata, centerFun = mean, scaleFun = sd)
mydata.bc.dist <- vegdist(mydata, method = "bray")
anosim(mydata.bc.dist, grouping, permutations = 999, distance = "bray", strata = NULL, parallel = getOption("mc.cores"))`
 
    