mantel_test | R Documentation |
Mantel and partial mantel test for dissimilarity matrices
mantel_test(
spec,
env,
group = NULL,
env_ctrl = NULL,
mantel_fun = "mantel",
spec_select = NULL,
env_select = NULL,
na_omit = TRUE,
spec_dist = NULL,
env_dist = NULL,
env_ctrl_dist = NULL,
seed = 123,
...
)
spec, env |
data frame object. |
group |
vector for grouping the rows. |
env_ctrl |
NULL (default), TRUE or a data frame. |
mantel_fun |
string, function of mantel test.
|
spec_select, env_select |
NULL (default), numeric or character vector index of columns. |
na_omit |
if TRUE (default), the incomplete cases will be removed. |
spec_dist |
NULL (default) or |
env_dist |
NULL (default) or |
env_ctrl_dist |
NULL (default) or |
seed |
a integer value. |
... |
extra params passing to |
a data.frame.
Hou Yun
## Not run:
library(vegan)
data("varespec")
data("varechem")
## set group id of `spec` on columns by `spec_select`
mantel_test(varespec, varechem,
spec_select = list(spec01 = 1:5, spec02 = 6:12))
## set group id of `spec` on columns by `spec_select`
## set group id of `env` on columns by `env_select`
mantel_test(varespec, varechem,
spec_select = list(spec01 = 1:5, spec02 = 6:12),
env_select = list(env01 = 1:5, env02 = 6:10, env03 = 11:14))
## set group id of all data on rows by `group`
set.seed(20211123)
sam_grp <- sample(paste0("sample", 1:3), 24, replace = TRUE)
mantel_test(varespec, varechem, group = sam_grp)
## partial mantel test
m <- matrix(rnorm(24*5), nrow = 24)
mantel_test(varespec, varechem, env_ctrl = m,
mantel_fun = "mantel.partial")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.