ordplots | R Documentation |
This function creates ordination plots based on the provided data and metadata. It supports multiple ordination methods and can generate plots for various metadata variables.
ordplots(
data,
metadata,
output,
outputname = NA,
method = "pcoa",
index = "bray/curtis"
)
data |
A matrix or data frame containing the main data, with samples as rows and features as columns. |
metadata |
A data frame containing metadata for the samples. Row names should match those in 'data'. |
output |
A character string specifying the directory where output files will be saved. |
outputname |
A character string for the name of the output file. If NA, the method name will be used. |
method |
A character string specifying the ordination method. Options are "tsne", "pcoa", or "pca". Default is "pcoa". |
index |
A character string specifying the distance index to use for PCoA. Default is "bray/curtis". |
The function performs the following steps: 1. Aligns the data and metadata based on common row names. 2. Performs the specified ordination method on the data. 3. Creates a PDF file containing ordination plots for each metadata variable. 4. Returns a list of the generated ggplot objects.
Ordination plots are not generated for metadata variables with less than 2 or more than 100 unique values.
A list of ggplot objects, one for each metadata variable plotted.
## Not run:
data <- matrix(rnorm(1000), ncol = 10)
metadata <- data.frame(group = rep(c("A", "B"), each = 50))
rownames(data) <- rownames(metadata) <- paste0("Sample", 1:100)
plots <- ordplots(data, metadata, output = "results", method = "pcoa")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.