Formatting data matrix for Jaccard Similiarity
I'm trying to do a Jaccard Similarity on my presence/absence data in RStudio but I receive this error.
jaccard_dist <- vegdist(dat2, method = "jaccard", binary = TRUE)
Error in vegdist(dat2, method = "jaccard", binary = TRUE) :
input data must be numeric
My data frame is currently organised like this
dat2<- data.frame(site_number=c("BHS1", "BHS2", "BHS3"),
sp_1=c(0,0,1),
sp_2=c(0,0,1) ,
sp_3=c(0,1,0) ,
sp_4=c(0,0,1) ,
sp_5=c(1,0,1) ,
sp_6=c(1,0,1))
All the species columns are numeric, not integers. But the site number is characters. How do I organise the data frame so that I no longer receive this error?
Thank you