| Title: | SAMPLE R |
|---|---|
| Description: | SAMPLE R package. |
| Authors: | Henrique Gouveia Bravo, Yacine Ben Chehida and Sanchia Van Der Meij |
| Maintainer: | Henrique Gouveia Bravo <[email protected]> and Yacine Ben Chehida <[email protected]> |
| License: | GPL-3 + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-09-16 09:58:09 UTC |
| Source: | https://github.com/yacinebenchehida/sample |
This function generates the prevalence rate plots for all the variables in question (e.g. species, habitats).
plotstab(data, info, outputName = "Results", outputDir = "./")plotstab(data, info, outputName = "Results", outputDir = "./")
data |
A dataframe generated by the function RunPerm() (a dataframe object). |
info |
A dataframe generated by the function StabAssess() (a dataframe object). |
outputName |
Prefix used for the output (a character; default output_N="Results"). |
outputDir |
Set output directory (a character). If left undefined the files will be generated in the user’s current directory. |
A text file (.txt) with the output values of the analysis, and a PDF file with the generated plots from the analysis.
data("coral_symbionts") set.seed(812) perm = RunPerm(input = coral_symbionts,replicates = 50) stable = stability(data = perm,stability_thres = 5 ,success_points = 5,diff = 2 ) plotstab(data = perm, info = stable, outputName = "Stability_example")data("coral_symbionts") set.seed(812) perm = RunPerm(input = coral_symbionts,replicates = 50) stable = stability(data = perm,stability_thres = 5 ,success_points = 5,diff = 2 ) plotstab(data = perm, info = stable, outputName = "Stability_example")
This function defines the number of permutations (default = 50) and subsequently runs the permutations on an input dataframe. A minimum number of 10 permutations is recommended in order to avoid having very large or very small stability values due to the stochastic nature of the process. On a large dataset, increasing the number of permutations can considerably slow down the analysis. Please refer to the Simulations section to see how changing permutation values can impact stability values.
RunPerm(input, replicates = 50)RunPerm(input, replicates = 50)
input |
Input dataframe (a dataframe object). |
replicates |
Number of permutation replicates to perform (an integer; default replicates=50). |
A dataframe with the output values of the permutation analysis.
data("coral_symbionts") perm <- RunPerm(input = coral_symbionts,replicates = 50) permdata("coral_symbionts") perm <- RunPerm(input = coral_symbionts,replicates = 50) perm
Only the input dataframe is required to run SAMPLE, all the other arguments have default values that can be adjusted (but it is not necessary to do so). To obtain the same output as in the example file, remember to set.seed(812) after importing the dataset. Alternatively, SAMPLE can be run using separate functions. To do so, please refer to RunPerm() for the first step of this process.
SAMPLE( input, output_N = "Results", replicates = 50, stability_thresh = 2, success_points = 10, diff = 1 )SAMPLE( input, output_N = "Results", replicates = 50, stability_thresh = 2, success_points = 10, diff = 1 )
input |
Input dataframe (a dataframe object). |
output_N |
Prefix used for the output (a character; default output_N="Results"). |
replicates |
Number of permutation replicates to perform (an integer; default replicates=50). |
stability_thresh |
Threshold used to define stability (an integer). This value will be divided by the square root of the number of replicates (a float; default stability_thresh = 2.0). |
success_points |
Number of successive (mean) prevalence rates that are below a threshold (see parameter stability_thresh) used to define stability (an integer; default stability_thresh = 10). |
diff |
Difference between absolute minimum and maximum values among the all the means used to set the stability threshold (a float; default diff = 1.0). |
A text file (.txt) with the output values of the analysis, and a PDF file with the generated plots from the analysis.
data("coral_symbionts") set.seed(812) SAMPLE(input = coral_symbionts,output_N = "Example",replicates = 50,stability_thresh = 2,success_points = 10,diff = 1)data("coral_symbionts") set.seed(812) SAMPLE(input = coral_symbionts,output_N = "Example",replicates = 50,stability_thresh = 2,success_points = 10,diff = 1)
This function determines the stability values for all of the input variables in the dataset (e.g. species, habitats). Stability here is defined as the minimum occurrence value at which the variable in question stayed stable. See the arguments below to understand how they can affect the stability values.
stability(data, stability_thresh = 2, success_points = 50, diff = 1)stability(data, stability_thresh = 2, success_points = 50, diff = 1)
data |
A dataframe generated by the function RunPerm(). |
stability_thresh |
Threshold used to define stability (an integer). This value will be divided by the square root of the number of replicates (a float; default stability_thresh = 2.0). |
success_points |
Number of successive (mean) prevalence rates that are below a threshold (see argument stability_thresh) used to define stability (an integer; default stability_thresh = 10). |
diff |
Difference between the absolute minimum and maximum values among the all means used to set the stability threshold (a float; default diff = 1.0). |
A dataframe with the output values of the stability assessment analysis.
data("coral_symbionts") set.seed(812) perm <- RunPerm(input = coral_symbionts,replicates = 50) stable <- stability(data = perm,stability_thresh = 5 ,success_points = 5,diff = 2 ) stabledata("coral_symbionts") set.seed(812) perm <- RunPerm(input = coral_symbionts,replicates = 50) stable <- stability(data = perm,stability_thresh = 5 ,success_points = 5,diff = 2 ) stable