Closed B-1991-ing closed 2 years ago
Hi Houyun,
Update
I noticed that when the table has the number value as "0", the error warning appeared.
Table screenshot
Error screenshot
Best,
Bing
If I have a matrix with the first whole column of 0 in the matrix. Should I directly delete it from the data frame?
Data frame screenshot
Best,
Bing
Hi Bing
I think this happens because the default distance method of spec is bray, but for the bray distance method, the row sum of the data (for each selected group) cannot be 0. So, you can solve this problem by setting the parameter spec_dist = dist_func(.FUN = "vegdist", method = "euclidean").
library(linkET)
set.seed(123)
spec <- data.frame(x = sample(0:2, 100, TRUE), y = sample(0:2, 100, TRUE))
env <- data.frame(x = rnorm(100), y = rnorm(100))
## Error: Reproduce your question
mantel_test(spec, env)
## OK
mantel_test(spec, env, spec_dist = dist_func(.FUN = "vegdist", method = "euclidean"))
Hi Bing
I think this happens because the default distance method of spec is bray, but for the bray distance method, the row sum of the data (for each selected group) cannot be 0. So, you can solve this problem by setting the parameter spec_dist = dist_func(.FUN = "vegdist", method = "euclidean").
library(linkET) set.seed(123) spec <- data.frame(x = sample(0:2, 100, TRUE), y = sample(0:2, 100, TRUE)) env <- data.frame(x = rnorm(100), y = rnorm(100)) ## Error: Reproduce your question mantel_test(spec, env) ## OK mantel_test(spec, env, spec_dist = dist_func(.FUN = "vegdist", method = "euclidean"))
In the next update, I'll be more careful with spec's default distance algorithm.
Hi Houyun,
I am using the linkET to see the correlation between two matrixes, error always happened in the Rstudio.
Error screenshot
The code linkET_Sib_amo_cox_code.pdf
The excel table omstrup33_sillebotten_mam copy.xlsx
Do you have any idea why it always occcurs?
Best,
Bing