| Title: | User Tools for Accessing the STOICH Project Database |
| Version: | 1.0.2 |
| Description: | User tools for working with The STOICH (Stoichiometric Traits of Organisms in their Chemical Habitats) Project database https://snr-stoich.unl.edu/. This package is designed to aid in data discovery, filtering, pairing water samples with organism samples, and merging data tables to assist users in preparing data for analyses. For additional examples see "Additional Examples" and the readme file at https://github.com/STOICH-project/STOICH-utilities. |
| URL: | https://github.com/STOICH-project/STOICH-utilities, https://snr-stoich.unl.edu/, https://stoichproject.wordpress.com/ |
| BugReports: | https://github.com/STOICH-project/STOICH-utilities/issues |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.1.0) |
| Imports: | tibble, tidyr, dplyr, readr, stringr, purrr, magrittr, lubridate, sf, rlang, units, stats, jsonlite |
| Suggests: | tidyverse, maps, knitr, rmarkdown, gt, glue, gluedown, kableExtra, testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| VignetteBuilder: | knitr |
| RoxygenNote: | 7.3.3 |
| NeedsCompilation: | no |
| Packaged: | 2025-11-24 19:28:30 UTC; Chad |
| Author: | Chad Petersen [aut, cre], Jessica Corman [ctb], Halvor Halvorson [ctb], Casey Brucker [ctb], Eli Wess [ctb], U.S. National Science Foundation [fnd] |
| Maintainer: | Chad Petersen <cpetersen4@unl.edu> |
| Repository: | CRAN |
| Date/Publication: | 2025-12-01 13:40:02 UTC |
stoichUtilities: User Tools for Accessing the STOICH Project Database
Description
User tools for working with The STOICH Project (Stoichiometric Traits of Organisms in their Chemical Habitats) database https://snr-stoich.unl.edu/. This package is designed to aid in data discovery, filtering, pairing water samples with organism samples, and merging data tables to assist users in preparing data for analyses. For additional examples see "Additional Examples" and the readme file at https://github.com/STOICH-project/STOICH-utilities.
Author(s)
Maintainer: Chad Petersen cpetersen4@unl.edu
Other contributors:
Jessica Corman jcorman3@unl.edu [contributor]
Halvor Halvorson hhalvorson@uca.edu [contributor]
Casey Brucker cbrucker@uwyo.edu [contributor]
Eli Wess ewess@uca.edu [contributor]
U.S. National Science Foundation [funder]
See Also
Useful links:
Report bugs at https://github.com/STOICH-project/STOICH-utilities/issues
Filter Based on Simulated Joins of STOICH Data Tables
Description
Filters STOICH data tables following a filtering operation against rows of other tables to remove any corresponding entries from other tables.
Usage
filterJoinSTOICH(dataTables, filtTable)
Arguments
dataTables |
The STOICH data tables filtered using filterSTOICH. |
filtTable |
The table name filtering was performed on. |
Value
Tables with corresponding entries that were removed from one table removed from the other tables.
Author(s)
Chad Petersen cpetersen4@unl.edu
Examples
## Not run:
# Not typically run independently. This function is called by filterSTOICH
# to clean up before returning data.
## End(Not run)
Filter Data in the STOICH Data Tables
Description
Filters the STOICH data from release files based on selected criteria.
Usage
filterSTOICH(dataTables, var, val, condition)
Arguments
dataTables |
The STOICH data tables loaded using loadSTOICH. |
var |
The STOICH variable to filter. Use View(stoichData$metadata) to see a table of all variables and their descriptions (assumes data was loaded into the variable "stoichData"). The variable can be either the joined variable name (including the table name) "SampleDate.SampleEvent" or the prejoin name "SampleDate". The joined variable name will be required for multiple variables with the same name (such as "Notes"). |
val |
The value or value range for the variable you want to filter. The conditions "greater than" and "less than" only work with a single numeric or date value, while "equal" and "not equal" work with a single value or an array of values (text, numeric or date). The "range" condition requires an array of 2 numeric or date values. |
condition |
The criteria used for filtering (greater than, less than, equal, not equal, range, etc.). See the val parameter for the possible inputs for each condition. |
Value
The STOICH data tables after filtering has been applied.
Author(s)
Chad Petersen cpetersen4@unl.edu
Examples
## Not run:
# Load the data
stoichData <- loadSTOICH(dataPath="C:/Users/example_user/STOICH_data_location")
# filtering by table such as:
stoichFiltered <- filterSTOICH(dataTables=stoichData,
var="TrophicMode",
val="photoautotroph",
condition="equal")
stoichFiltered <- filterSTOICH(dataTables=stoichData,
var="Latitude",
val=c(54.1, 103.1),
condition="range")
stoichFiltered <- filterSTOICH(dataTables=stoichData,
var="Type.OrganismStoichiometry",
val="seston",
condition="equal")
stoichFiltered <- filterSTOICH(dataTables=stoichData,
var="Name",
val=c("Suggs", "Barco"),
condition="contains")
stoichTable <- joinSTOICH(stoichFiltered)
## End(Not run)
Join STOICH Data Tables
Description
Joins the STOICH data tables from release files into a single table.
Usage
joinSTOICH(dataTables)
Arguments
dataTables |
The STOICH data tables loaded using loadSTOICH. |
Value
A single table merged from the individual STOICH data tables.
Author(s)
Chad Petersen cpetersen4@unl.edu
Examples
## Not run:
# Load the data
stoichData <- loadSTOICH(dataPath="C:/Users/example_user/STOICH_data_location")
# filtering by table such as:
stoichFiltered <- filterSTOICH(dataTables=stoichData,
var="TrophicMode",
val="photoautotroph",
condition="not equal") |>
filterSTOICH(dataTables=stoichFiltered,
var="Latitude",
val=c(104.92, 103.01),
condition="range")
stoichTable <- joinSTOICH(stoichFiltered)
## End(Not run)
Load STOICH Data
Description
Loads STOICH data from release files.
Usage
loadSTOICH(dataPath = file.path(path.expand("~"), "data"))
Arguments
dataPath |
The path to the STOICH data directory. |
Value
A list containing the STOICH data tables
Author(s)
Chad Petersen cpetersen4@unl.edu
Examples
## Not run:
stoichData <- loadSTOICH(dataPath="C:/Users/example_user/STOICH_data_location")
## End(Not run)
Pair STOICH Data with Similar Locations & Dates
Description
Looks for matches between organism stoichiometry and water chemistry data when the date & time or GPS locations are slightly off. This could be time intensive so if possible perform any filtering operations before locating data pairs.
Usage
locateDataPairsSTOICH(
dataTables,
timeDiff = 7,
timeUnits = "days",
distance = 1,
pairMethod = "Min Time",
ignoreExisting = TRUE
)
Arguments
dataTables |
The STOICH data tables loaded using loadSTOICH. |
timeDiff |
The maximum time difference to consider for matches between data. |
timeUnits |
What units to use for the time difference search (months, weeks, days, hours). |
distance |
Distance between data points in km. |
pairMethod |
How to determine the best pair from multiple matches. Options are: Min Time - Prioritize the minimum time. Min Dist - Prioritize the minimum distance. #days=#km - Minimize in space and time using a relation for # days equal # kilometers (enter decimal numbers, i.e. "1.5days=2.1km"). Avg Water - Takes the average for all the water chemistry data returned that matches an organism data entry. |
ignoreExisting |
Determines if the existing data pairs should be ignored and processed the same as other data. Probably only useful for averaging water data since the other data points already have matching time and distance data. |
Value
The STOICH data tables after pairs have been found. The water chemistry data will be copied to a new entry with a SampleEventId matching the organism stoichiometry data. The notes will be updated adding a comment about the original SampleEventId(s), such as "OriginalSampleEventId=(10, 11, 12)" for an average of 3 water chemistry samples to the Notes of tbl_WaterChemistry.
Author(s)
Chad Petersen cpetersen4@unl.edu
Examples
## Not run:
# Load the data
stoichData <- loadSTOICH(dataPath="C:/Users/example_user/STOICH_data_location")
# filtering by table and pairing example with pipes:
stoichFiltered <- stoichData |>
filterSTOICH(var="Latitude", val=c(54.1, 103.1), condition="range") |>
locateDataPairsSTOICH(timeDiff=2, timeUnits="weeks", distance=1, pairMethod="1.5days=2.1km")
stoichTable <- joinSTOICH(stoichFiltered)
## End(Not run)
Explore The STOICH Data
Description
Used to help explore the STOICH data.
Usage
metadataSTOICH(dataTables, metadata = NA)
Arguments
dataTables |
The STOICH data tables loaded using loadSTOICH. |
metadata |
A character describing what type of metadata is being requested. Possible options are: "variables", "joined", "full". metadata="joined" returns the variable names after joinSTOICH is performed (you can use this name before the join to identify a table and variable). metadata="full" returns a table of all the variables, the table name it belongs to and what data is stored in each variable. |
Value
A vector or table with the requested data.
Author(s)
Chad Petersen cpetersen4@unl.edu
Examples
## Not run:
# Load the data
stoichData <- loadSTOICH(dataPath="C:/Users/example_user/STOICH_data_location")
# list the variable names
metadataSTOICH(stoichData, "variables")
## End(Not run)
Check STOICH Data Table Format
Description
Checks if the STOICH data tables loaded from release files are in the proper format for joining and filtering.
Usage
verifySTOICH(dataTables)
Arguments
dataTables |
The STOICH data tables loaded using loadSTOICH. |
Value
True if the STOICH data tables are the correct format or stop and return the first error found if an incorrect format is detected.
Author(s)
Chad Petersen cpetersen4@unl.edu
Examples
## Not run:
# Load the data
stoichData <- loadSTOICH(dataPath="C:/Users/example_user/STOICH_data_location")
verifySTOICH(stoichData)
## End(Not run)