Description Usage Arguments Details Note Examples
Redundancy Analysis using vegan
capscale
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | doRDA(tcm.or.dist, env, verbose = TRUE)
matchCMEnv(cm, env, is.transposed = FALSE, verbose = TRUE)
plotCorrelations(df.numeric, corr.gram = FALSE, cex.axis = 0.75,
cex.cor = 0.9, col = "#333333")
plotRDA(rda, env, colour.id = "Elevation",
title = "Backward RDA, Jaccard distance", x.lab = "", y.lab = "",
palette = c("blue", "orange"), scale.limits.min = NULL,
no.legend = FALSE, legend.title = "Elevation (m)", verbose = TRUE, ...)
printXTable.RDA(rda, matrix.name = "", taxa.group = "", table.file = NULL,
invalid.char = FALSE)
|
tcm.or.dist |
A transposed community matrix or dist object of distances between samples. Rows are samples. |
env |
The enviornmental meta-data, where rows are samples,
and they must be same as rownames(tcm.or.dist) inlcuding order.
In addition, make sure rownames (enviornmental variables)
are valid to |
verbose |
More details. Default to TRUE. |
cm |
A community matrix. |
is.transposed |
If TRUE, then the community matrix is already
transposed to be the valid input of |
df.numeric |
The data frame or matrix containing numeric variables (columns) to plot. |
corr.gram |
Logical, if use |
rda |
The ordination result from |
colour.id |
The column name in |
title, x.lab, y.lab |
Title, x, y label. |
palette |
Refer to |
scale.limits.min |
Manually set the minimum data range of the colour scale,
for example, in legend. The code set |
no.legend, legend.title |
Configure legend. |
matrix.name |
The string to locate the matrix from its file name. Only used for table name and label here. |
taxa.group |
The taxonomic group. Only used for table name and label here. |
table.file |
If NULL, then print the results to console, otherwise print them to the file. Default to NULL. |
rda |
The list of results from |
doRDA
makes Constrained Analysis
of Principal Coordinates for
eDNA data sets given environmental variables.
matchCMEnv
matches the sample names between
community matrix and the enviornmental meta-data including the order,
in order to provide the valid input to RDA analysis doRDA
.
Preprecessing can be applied by preprocessCM
and preprocessEnv
.
plotCorrelations
plots numeric variables (columns).
Tip: use "%<a-%"
in pryr to save plots.
plotRDA
plots a ordination result from doRDA
.
However, there are still two columns "Plot" and "shortIDs" in the
intermediate data "sites" hard coded to be able to make shorter texts.
sites$Plot <- gsub("-[A-Z]", "", rownames(sites))
and
sites$shortIDs <- gsub("(CM30|CM31|Plot)", "", rownames(sites))
This is expecting to be improved in future.
printXTable.RDA
prints xtable
given rda results.
Make sure you are using the correct data type
for both the community matrix and enviornmental meta-data.
Run sapply(env, class)
to check if the value
should be discrete(character) or numeric.
convertType
will convert data frame columns
to different type easily.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # 1. get the community matrix and enviornmental meta-data
cm <- getCommunityMatrix("16S", min2=T, by.plot=F)
env <- getEnvData(by.plot=F)
# 2. preprocessing
cm.prep <- preprocessCM(cm, rm.samples=c("CM30b51","CM30b58"), min.abund=5, mean.abund.thr=0.025)
env.prep <- preprocessEnv(env, rm.samples=c("CM30b51","CM30b58"), log.var=c(14:20), sel.env.var=c(4,5,8,9,14:22))
sapply(env, class)
# 3. match samples and transpose cm
tcm.env <- matchCMEnv(cm.prep, env.prep)
# 4. RDA
rda <- doRDA(tcm.env$tcm, tcm.env$env)
# 5. result
rda.pl <- plotRDA(rda[["backward"]], tcm.env$env)
rda.pl$plot
printXTable.RDA(rda, matrix.name="16S", taxa.group="all")
# already transposed
tcm.env <- matchCMEnv(tcm, env, is.transposed=T)
# Note colSums(cm) are based on samples
tcm.env <- matchCMEnv(cm, env)
# before RDA
require(pryr)
p %<a-% plotCorrelations(tcm.env$env)
rda.pl <- plotRDA(rda.list[[1]][["backward"]], env.prep, scale.limits.min=0)
printXTable.RDA(rda, matrix.name="16S", taxa.group="BACTERIA")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.