| Title: | Permutations of Treatment Labels and TITAN2 Analysis |
| Version: | 1.0.2 |
| Description: | Permute treatment labels for taxa and environmental gradients to generate an empirical distribution of change points. This is an extension for the 'TITAN2' packagehttps://cran.r-project.org/package=TITAN2. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Language: | en-US |
| LazyData: | true |
| URL: | https://github.com/USEPA/pTITAN2 |
| RoxygenNote: | 7.1.2 |
| Depends: | R (≥ 3.5.0) |
| Imports: | data.table |
| Suggests: | bookdown, DiagrammeR, dplyr (≥ 1.0.0), knitr, magrittr,readr, rmarkdown, TITAN2, testthat (≥ 3.0.0), tidyr |
| VignetteBuilder: | knitr |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2022-03-07 16:43:47 UTC; peterdewitt |
| Author: | Peter DeWitt |
| Maintainer: | Peter DeWitt <peter.dewitt@cuanschutz.edu> |
| Repository: | CRAN |
| Date/Publication: | 2022-03-07 17:00:02 UTC |
Example Data Sets
Description
Four Example data sets for use the pTITAN2 package.
Usage
C_IC_D_06_wIDC_IC_N_06_wIDCD_06_Mall_wIDCN_06_Mall_wIDFormat
An object of classdata.frame with 251 rows and 2 columns.
An object of classdata.frame with 124 rows and 2 columns.
An object of classdata.frame with 251 rows and 501 columns.
An object of classdata.frame with 124 rows and 501 columns.
Details
Example data sets are from publicly available macroinvertebrate survey datafrom California. The data sets are broken down between the environmentalvariable, in this case percent impervious cover, and macroinvertebrate data.Separate data files are provided for each 'treatment' that is explored. Inthis case, the treatments are data from either drought (dry) or normalprecipitation years in the Chaparral region of California.
CN_06_Mall_wID (Chaparral Region, Treatment = Normal) file containsraw macroinvertebrate density data for 500 possible macroinvertebrate codesfor each taxonomic level (class, order, family, genus).
The raw data files are provided for your use as well. See example below foraccessing these files.
Examples
head(C_IC_D_06_wID) # Environemntal Gradient, Dry Treatmenthead(C_IC_N_06_wID) # Environemntal Gradient, Normal Treatmenthead(CD_06_Mall_wID) # Taxonomic, Dry Treatmenthead(CN_06_Mall_wID) # Taxonomic, Normal Treatment# Get the paths to the raw data fileslist.files(system.file("extdata", package = "pTITAN2"))Occurrence
Description
Generate a taxonomic data set with codes which have at least n occurrences.
Usage
occurrences(data, n = 5L)Arguments
data | A |
n | the minimum number of occurrences. |
Details
Of the codes with at least n occurrences, the code with the most taxonomicdetail needs to be selected for thetitan run. Thismeans if the macroinvertebrate count has at least n occurrences in a genuscode, the family, order, and class codes associated with these counts shouldbe removed. Or, for another example, if there are too few counts at thegenus level, but at least n counts at the family level- the family code wouldbe retained and the order and class codes would be removed.
Coding: All of the macroinvertebrates were coded so the first two lettersindicate the class, the second two letters indicate the order, the third twoletters indicate the family, and the last two numbers indicate the genus."00" indicates that there is no information at that level. For example: Acode that is 'Bi000000' is the Bivalvia class, while BiVe0000 is the Bivalviaclass, Veneroida order. BiVeSh00 is the Bivalvia class, Veneroida order,Spheriridae family. BiVeSh01 is a genus within that family.
NOTE: The example script that inspired the development of this functionrequired the data set to have the column names in alpha order. This functionrelaxes that requirement by using thearrange call.
Value
adata.frame with six columns:taxon,Class,Order,Family,Genus, andcount.
See Also
vignette(topic = "pTITAN2", package = "pTITAN2")
Examples
# Report the tax with minimum of five (default) occurrences.occurrences(CN_06_Mall_wID[, -1])# Report the tax with at least six occurrencesoccurrences(CN_06_Mall_wID[, -1], n = 6)Permutations of Treatment Labels and TITAN2 Analysis
Description
Permute treatment labels for taxa and environmental gradients to generatean empirical distribution of change points.
Permutation Example Result
Description
Results for a permutation example.
Usage
permutation_exampleFormat
An object of classdata.frame with 10 rows and 7 columns.
Details
The code to generate this example permuation set can be found viasystem.file("example-scripts", "permutation_example.R", package = "pTITAN2")
See Also
vignette("pTITIAN2")
Permute
Description
Permute treatment labels for a taxa and associated environmental gradients.
Usage
permute(taxa, envs, sid)permute2(..., minTaxonFreq = 3L, trys = 100L)Arguments
taxa | a list of |
envs | a list of |
sid | a character vector of length one with the name of the columnidentifying the station id. |
... | passed to permute |
minTaxonFreq | min number of occurrences for each taxon |
trys | maximum number of attempts to generate a meaningful permutation |
Details
The taxa and envs lists are expected to be of equal length and that the ithelement of taxa list is associated with the ith element of the envs list.That is, the taxa and environmental gradient for treatment 1 are both thefirst elements of the respective lists, the taxa and environmental gradientfor treatment 2 are the second elements for the respective lists, etc.
The environmental gradient data.frames are expected to have two columns, onewith the station ID and one with the data defining the gradient.
The taxa data.frames are expected to have the station ID column as well.Important The station ID column name needs to be the same for all thetaxa and environmental gradient data.frames.
Value
A list of lists of lists. At the top level the elements are the treatmentgroups. There are as many elements as the length of the lists taxa and envs.
The second level are the taxa and environmental gradient.
See Also
vignette(topic = "pTITAN2", package = "pTITAN2")
Examples
example_permutation <- permute(taxa = list(CD_06_Mall_wID, CN_06_Mall_wID), envs = list(C_IC_D_06_wID, C_IC_N_06_wID), sid = "StationID")str(example_permutation, max.level = 2)