### Install EcolUtils Package Source: https://rdrr.io/github/GuillemSalazar/EcolUtils Install the latest version of the EcolUtils package from GitHub using the remotes package. ```r install.packages("remotes") remotes::install_github("GuillemSalazar/EcolUtils") ``` -------------------------------- ### Install EcolUtils Development Version from GitHub Source: https://rdrr.io/github/GuillemSalazar/EcolUtils/f/README.md Install the current development version of the EcolUtils package directly from GitHub using the devtools package. ```r devtools::install_github("GuillemSalazar/EcolUtils") ``` -------------------------------- ### Install vegan and spaa Packages Source: https://rdrr.io/github/GuillemSalazar/EcolUtils/f/README.md Install the vegan and spaa R packages from CRAN. These are dependencies for EcolUtils. ```r install.packages("vegan") install.packages("spaa") ``` -------------------------------- ### Example Usage of smwda Source: https://rdrr.io/github/GuillemSalazar/EcolUtils/man/smwda.html Demonstrates how to use the smwda function with vegan package data, including data preparation and plotting the results. ```R library(vegan) data("varespec") data("varechem") tmp<-smwda(vegdist(varespec),varechem$N) plot(tmp$windows$env.var.mean,tmp$windows$stat.real.zscore,col=tmp$windows$sign,type="b",pch=19) ``` -------------------------------- ### Adonis Pair Function Example Source: https://rdrr.io/github/GuillemSalazar/EcolUtils/man/adonis.pair.html This example demonstrates how to use the adonis.pair function with sample ecological data, including loading necessary libraries and preparing the data. ```R library(vegan) data(dune) data(dune.env) adonis.pair(vegdist(dune),dune.env$Management) ``` -------------------------------- ### Load EcolUtils Package Source: https://rdrr.io/github/GuillemSalazar/EcolUtils/f/README.md Attach the EcolUtils package to your R session to start using its functions. ```r library(EcolUtils) ``` -------------------------------- ### Citation for EcolUtils Package Source: https://rdrr.io/github/GuillemSalazar/EcolUtils/f/README.md To view the recommended citation for the EcolUtils package, use this R command. ```r citation("EcolUtils") ``` -------------------------------- ### niche.val Function Signature Source: https://rdrr.io/github/GuillemSalazar/EcolUtils/man/niche.val.html This is the primary function signature for niche.val. It takes community data, an environmental variable, and parameters for permutation and confidence intervals. ```R niche.val(comm.tab, env.var, n = 1000, probs = c(0.025, 0.975)) ``` -------------------------------- ### Adonis Pair Function Signature Source: https://rdrr.io/github/GuillemSalazar/EcolUtils/man/adonis.pair.html This snippet shows the basic signature of the adonis.pair function, outlining its main arguments. ```R adonis.pair(dist.mat, Factor, nper = 1000, corr.method = "fdr") ``` -------------------------------- ### smwda Function Signature Source: https://rdrr.io/github/GuillemSalazar/EcolUtils/man/smwda.html Defines the parameters for the smwda function, including distance matrix, environmental variable, window size, number of replicates, and probability quantiles. ```R smwda(comm.dist.mat, env.var, w.size = 10, nrep = 1000, probs = c(0.025, 0.975)) ``` -------------------------------- ### smwda Function Source: https://rdrr.io/github/GuillemSalazar/EcolUtils/man/smwda.html Performs a split moving-window analysis on multivariate community data using permutations to assess significance. It calculates a statistic based on the ratio of inter-half to intra-half distances within windows and relates it to an environmental variable. ```APIDOC ## smwda Function ### Description Performs a split moving-window analysis based on multivariate community data and permutations. It calculates a statistic by comparing mean distances between samples in different halves of a window to mean distances within the same halves, relative to an environmental variable. ### Arguments * `comm.dist.mat` (matrix) - Dissimilarity matrix of community data. * `env.var` (vector) - A continuous environmental variable. * `w.size` (numeric) - The size of the moving window. Must be an even number. * `nrep` (numeric) - The number of randomizations (permutations) to perform for significance testing. Defaults to 1000. * `probs` (numeric vector) - Probabilities for calculating confidence intervals. Defaults to `c(0.025, 0.975)`. ### Details For each window, the data is split into two halves. A statistic is computed as the ratio of the mean distance between samples belonging to different halves to the mean distance between samples belonging to the same half. Significance is determined by comparing the observed statistic to null statistics generated through `nrep` resamplings of the distance matrix order. A z-score for the statistic is also provided. ### Value A list containing: 1. `windows`: A data frame with columns for the mean `env.var` of the two central samples in the window, the min and max `env.var` values of the window, the calculated statistic, its z-score, and its significance. 2. A data frame containing the mean and two quantiles of the null statistic based on `probs`, all null statistic values, and a mapping from windows to samples. ### Author(s) Guillem Salazar ### Examples ```R library(vegan) data(varespec) data(varechem) tmp <- smwda(vegdist(varespec), varechem$N) plot(tmp$windows$env.var.mean, tmp$windows$stat.real.zscore, col = tmp$windows$sign, type = "b", pch = 19) ``` ``` -------------------------------- ### adonis.pair Function Source: https://rdrr.io/github/GuillemSalazar/EcolUtils/man/adonis.pair.html Performs pairwise comparisons for all levels of a factor using Permutational MANOVA. It applies the adonis function from the vegan package to all pairs of factor levels and corrects p-values using p.adjust. ```APIDOC ## adonis.pair Function ### Description Performs pairwise comparisons for all levels of a factor using Permutational MANOVA. It applies the adonis function from the vegan package to all pairs of factor levels and corrects p-values using p.adjust. ### Function Signature adonis.pair(dist.mat, Factor, nper = 1000, corr.method = "fdr") ### Parameters #### Arguments - **dist.mat** (Dissimilarity object) - Required - Dissimilarity object to be used for comparisons. - **Factor** (Factor) - Required - The factor whose levels are to be compared. - **nper** (numeric) - Optional - The number of permutations to perform. Defaults to 1000. - **corr.method** (string) - Optional - The p-value's correction method (from `p.adjust`). Defaults to "fdr". ### Returns Data frame with the R2, p-values and corrected p-values for each pairwise combination. ### Example ```R library(vegan) data(dune) data(dune.env) adonis.pair(vegdist(dune), dune.env$Management) ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.