| Title: | Extract Species Ecological Parameters from Www.freshwaterecology.info |
| Version: | 1.0.0 |
| Description: | Support the extraction and seamless integration of species ecological traits or preferences from the www.freshwaterecology.info into several ecological model workflows. During data extraction, different taxonomic levels are acceptable, including species, genus, and family, based on the availability of data in the database. The data is cached after the first search and can be accessed during and after online interactions. Only scientific names are acceptable in the search; local or English names are not allowed. A user API key is required to start using the package. |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| URL: | https://github.com/AnthonyBasooma/fwtraits, https://anthonybasooma.github.io/fwtraits/, https://github.com/AnthonyBasooma/fwtraits/releases/tag/V1.0.0 |
| BugReports: | https://github.com/AnthonyBasooma/fwtraits/issues |
| Depends: | R (≥ 4.1.0) |
| Imports: | curl, httr2, jsonlite, methods, utils, rstudioapi, R.cache |
| Suggests: | ggplot2, knitr (≥ 1.48), rmarkdown (≥ 2.28), sf, vcr, dplyr, tidytext, testthat (≥ 3.0.0), FD, tidyr, tibble, stats, cluster |
| Config/testthat/edition: | 3 |
| VignetteBuilder: | knitr |
| LazyData: | true |
| NeedsCompilation: | no |
| Packaged: | 2025-11-06 14:53:10 UTC; anthbasooma |
| Author: | Anthony Basooma |
| Maintainer: | Anthony Basooma <anthony.basooma@boku.ac.at> |
| Repository: | CRAN |
| Date/Publication: | 2025-11-11 10:00:16 UTC |
Check for packages to install and respond to use
Description
Check for packages to install and respond to use
Usage
check_packages(pkgs)
Arguments
pkgs |
list of packages to install |
Value
error message for packages to install
Checks the traits spelling compared to user input.
Description
Checks the traits spelling compared to user input.
Usage
checktrait(x, std, mindist = 0.3, error = 0.8, grp = NULL, warn = TRUE)
Arguments
x |
|
std |
|
mindist |
|
error |
|
grp |
|
warn |
|
Value
list or string. A list, vector or string of cleaned traits names based on
the user provided and standard database traits for downloading.
Data with ecological parameters classification.
Description
A tibble
Usage
data(classifydata)
Format
A tibble The dataset has 817 rows and 4 columns.
Organism group: Are the taxonomic groups in the www.freshwaterecology.info database.
parameter_cleaned: Are the ecological parameter names in the database.
DataType: Are the data classification for each ecological parameter. The data types are still under revision to improve harmony. Therefore, the users can provide a different classification based on their expertise.
Details
The database will be used internally to assign data types such as nominal, ordinal, ratio, and interval to ecological parameters.
References
Schmidt-Kloiber, A., & Hering, D. (2015). Www.freshwaterecology.info - An online tool that unifies, standardises and codifies more than 20,000 European freshwater organisms and their ecological preferences. Ecological Indicators, 53, 271-282. https://doi.org/10.1016/j.ecolind.2015.02.007.
Examples
## Not run:
data("classifydata")
classifydata
## End(Not run)
Check and clean species names to match standard names in the database.
Description
Check and clean species names to match standard names in the database.
Usage
clean_names(
sp,
grouplists,
prechecks = FALSE,
standard_dataset = NULL,
percenterror = 80,
errorness = 30,
full = FALSE,
warn,
taxalevel
)
Arguments
sp |
|
grouplists |
|
prechecks, standard_dataset |
|
percenterror |
|
errorness |
|
full |
|
warn |
To alert user on the species names cleaning errors and warnings. |
taxalevel |
|
Value
vector or string clean species name that is also found in the database.
Internal package and create dummy codes
Description
Internal package and create dummy codes
Usage
fuzzy_codes(trait, FD)
Arguments
trait |
|
FD |
|
Steps to follow in using the Freshwater Information Platform
Description
Steps to follow in using the Freshwater Information Platform
Usage
fw_be4ustart()
Value
list steps to follow in using the FWDB
Author(s)
Anthony Basooma
Examples
## Not run:
b4us <- fw_be4ustart()
## End(Not run)
Get database citations
Description
Get database citations
Usage
fw_cite(cachefolder = "cache")
Arguments
cachefolder |
|
Value
string of the package citation
Standard table with taxonomic groups and their traits explanations.
Description
Standard table with taxonomic groups and their traits explanations.
Usage
fw_dbguide(organismgroup = NULL, cachefolder = "cache")
Arguments
organismgroup |
|
cachefolder |
|
Value
dataframe A dataset with taxonomic groups, traits and their explanations.
Examples
## Not run:
dbase <- fw_dbguide(cachefolder = 'cache')
## End(Not run)
Compute the functional diversity indices and community weighted means.
Description
Compute the functional diversity indices and community weighted means.
Usage
fw_fdcompute(
fwdata,
sitesdata,
species,
sites = NULL,
dist = 1000,
abund = NULL,
FD = TRUE,
dummy = TRUE
)
Arguments
fwdata |
|
sitesdata |
|
species |
|
sites |
|
dist |
|
abund |
|
FD |
|
dummy |
|
Value
dataframe
Examples
## Not run:
set.seed(1135)
data('speciesdata')
speciesdata$abundance <- rnorm(n = nrow(speciesdata), 4.3, 1.2)
spgeo1 <- speciesdata |>
sf::st_as_sf(coords = c('decimalLongitude', 'decimalLatitude'), crs = sf::st_crs(4326))
sptraits <- fw_fetchdata(data = speciesdata,
ecoparams = c('rheophily habitat', 'spawning habitat',
'feeding diet adult'),
taxonomic_column = 'scientificName',
organismgroup = 'fi')
#functional richness
testdata5 <- fw_fdcompute(fwdata = sptraits,
sitesdata = speciesdata,
sites = 'waterBody',
species = 'scientificName',
FD = TRUE)
## End(Not run)
For computing the functional dendogram
Description
For computing the functional dendogram
Usage
fw_fdendro(fwdata, method = "average", k = 4, plot = FALSE)
Arguments
fwdata |
|
method |
|
k |
|
plot |
|
Value
dataframe, plot
Examples
## Not run:
fishtraits <- fw_fetchdata(data = speciesdata,
ecoparams = c('rheophily habitat', 'spawning habitat',
'feeding diet adult'),
taxonomic_column = 'scientificName',
organismgroup = 'fi')
head(fdendoclust, 3)
table(fdendoclust$cluster)
## End(Not run)
Extracting the traits from the downloaded data.
Description
Extracting the traits from the downloaded data.
Usage
fw_fetchdata(
data,
organismgroup,
ecoparams = NULL,
taxalevel = "species",
taxonomic_column = NULL,
organismgroup_column = NULL,
apikey = NULL,
seed = 1134,
secure = TRUE,
percenterror = 80,
errorness = 20,
warn = FALSE,
inform = FALSE,
cachefolder = "cache",
details = FALSE
)
Arguments
data |
|
organismgroup |
|
ecoparams |
|
taxalevel |
|
taxonomic_column |
|
organismgroup_column |
|
apikey |
|
seed |
|
secure |
|
percenterror |
|
errorness |
|
warn |
|
inform |
|
cachefolder |
|
details |
|
Value
dataframe The output has four sections, including
ecodata, which is the complete dataframe with all the taxonomic names and ecological parameters. \ item taxasearch: is a table with the taxonomic names,both original and cleaned names.
fetch: an indication that data has been fetched from www.freshwaterecology.info.
fun_call: A functional call used internally to review the data cleaning process.
Examples
## Not run:
dfextract <- fw_fetchdata(data = "Abramis brama", organismgroup = 'fi', inform = TRUE,
ecoparams = 'migration', cachefolder = 'cache' )
## End(Not run)
Auto generation of species sites
Description
Auto generation of species sites
Usage
fw_geosites(x, dist = 1000)
Arguments
x |
|
dist |
|
Value
dataframe
Examples
## Not run:
geospdata <- speciesdata |>
sf::st_as_sf(coords = c('decimalLongitude', 'decimalLatitude'),
crs = sf::st_crs(4326))
xx <- fw_geosites(geospdata)
## End(Not run)
For loading the API key from the environment.
Description
For loading the API key from the environment.
Usage
fw_keyload(keyvar = "API_KEY")
Arguments
keyvar |
|
Value
string of API
Function to retrieve all the traits in the database.
Description
Function to retrieve all the traits in the database.
Usage
fw_paramlist(cachefolder = NULL)
Value
list List of traits for all the taxa groups and orders in the database.
Author(s)
Anthony Basooma
Open the registration page
Description
Open the registration page
Usage
fw_register()
Value
registration page
To download data from the Freshwaterecology.info database.
Description
The function provides seamless access and download of species ecological parameters, traits, or indicators from the www.freshwaterecology.info database. The function allows multiple organism groups, including macroinvertebrates, fish, phytoplankton, phytobenthos, macrophytes, and diatoms.
Usage
fw_searchdata(
organismgroup,
taxa_searched = NULL,
ecoparams = NULL,
apikey = NULL,
warn = TRUE,
seed = 1135,
secure = TRUE,
inform = FALSE,
taxalevel = NULL,
cachefolder = "cache"
)
Arguments
organismgroup |
|
taxa_searched |
|
ecoparams |
|
apikey |
|
warn |
|
seed |
|
secure |
|
inform |
|
taxalevel |
|
cachefolder |
|
Details
Downloading macroinvertebrates data takes a lot of time because the database
has a lot of data, considerably slowing the process. Therefore, the
taxa_searched parameter is recommended for the user to indicate only
particular traits, family, orders, or taxa group where the species falls.
Also, the phytobenthos requires providing the taxa_searched to enable a
search for a particular taxon group. The parameter should not be provided for
other organism groups because it will not be used in the data search.
Value
List of download species traits, ecological paramaeters or traits.
Examples
## Not run:
dfsearch <- fw_searchdata(organismgroup = 'fi',
ecoparams = 'migration', cachefolder = 'cache')
## End(Not run)
Function and instructions creating the API_KEY variable in the User environment.
Description
Function and instructions creating the API_KEY variable in the User environment.
Usage
fw_setapikey(verbose = TRUE)
Arguments
verbose |
|
Value
string of instructions for saving or setting the API in the R session.
Access and loading the token key
Description
The function updates the authentication token automatically, which the servers generate every six hours. The function uses the API key, a one-time key provided during registration or by database managers for already registered users. Since the authentication token expires, the seed parameter allows caching across user sessions. Therefore, the data downloaded with a particular seed will be stored in memory and can be retrieved by the user. PC rather than from servers, and hence, tremendously optimize the speed of data access. The token is generated in two ways, depending on whether the codes will be shared with others or for personal use. If they are for personal use, the API key is directly pasted into the pop-up after the fw_token is executed. However, in the latter circumstance, it is advisable to store the API key in the R user environment and encrypt it during code execution. Check the vignettes for handling the API key on the fwtraits GitHub.
Usage
fw_token(
apikey = NULL,
seed = NULL,
cachefolder = NULL,
secure = TRUE,
inform = FALSE
)
Arguments
apikey |
|
seed |
|
cachefolder |
|
secure |
|
inform |
|
Value
string token authentication token key
See Also
Examples
## Not run:
#1.Use the API key in shared R examples
## End(Not run)
ggplot2 visualization.
Description
ggplot2 visualization.
Usage
fw_visualize(
output,
scales = "free",
ncol = 2,
params = NULL,
organism_group = NULL,
color = "purple",
na.rm = TRUE
)
Arguments
output |
fetchdata output only accepted. |
scales |
indicate if the scales are free, free_x, and free_y. |
ncol |
Number of columns to display the data in facet_wrap. |
params |
species ecological parameters selected if there are more than one. |
organism_group |
Particular organism group to filter out to allow visualization. |
color |
|
na.rm |
|
Value
ggplot2 display of the retrieved ecological parameters
Examples
## Not run:
fetchdata <- fw_fetchdata(data = c("Abramis brama",'Salmo trutta fario'),
organismgroup = 'fi',
ecoparams = c('migration',"rheophily habitat"), cachefolder = 'cache')
fw_visualize(fetchdata)
## End(Not run)
Taxonomic data for species in the freshwaterecology.info database
Description
A tibble
Usage
data(invertbackbone)
Format
A tibble 10421 rows and 3 columns.
Taxgroup: Higher taxonomic grouping for the species, for example, Bivalvia.
Family: Taxonomic classification, e.g., CARDIIDAE
Taxon: Lower taxonomic grouping for the species.eg., Parvicardium exiguum
Details
Standard taxonomic backbone for macroinvertebrates from www.freshwaterecology.info. All macroinvetebrates species are crosschecked with this database improve quality control of the species names provided by the user.
References
Schmidt-Kloiber, A., & Hering, D. (2015). www.freshwaterecology.info - An online tool that unifies, standardizes and codifies more than 20,000 European freshwater organisms and their ecological preferences. Ecological Indicators, 53, 271-282. https://doi.org/10.1016/j.ecolind.2015.02.007.
Examples
## Not run:
data("invertbackbone")
invertbackbone
## End(Not run)
Taxonomic data for the phytobentho species in www.freshwaterecology.info database.
Description
A tibble
Usage
data(pbenthodata)
Format
A tibble The dataset has 1857 rows and 2 columns.
Taxgroup: Higher taxonomic grouping for the species, for example, Bacillariophyceae.
Taxon: Lower taxonomic grouping for the species.eg., Achnanthes acus, Achnanthes brevipes, Achnanthes brevipes var. brevipes
Details
This dataset was extracted from the www.freshwaterecology.info database and formed a standardized reference for the species names for phytobenthos. Therefore, all user-provided species are checked across this database to identify whether or not they exist.
References
Schmidt-Kloiber, A., & Hering, D. (2015). Www.freshwaterecology.info - An online tool that unifies, standardises and codifies more than 20,000 European freshwater organisms and their ecological preferences. Ecological Indicators, 53, 271-282. https://doi.org/10.1016/j.ecolind.2015.02.007.
Examples
## Not run:
data("pbenthodata")
pbenthodata
## End(Not run)
Efiplus data used to develop ecological sensitivity parameters for riverine species in European streams and rivers.
Description
A tibble
Usage
data(speciesdata)
Format
A tibble 99 rows and 23 columns.
scientificName: The fish species names extracted from the EFIPLUS dataset.
waterBody: The water body from which the species records were collected.
decimalLatitude: Species location
decimalLongitude: Species occurrence records.
MRR: The locality where the species was collated or sampled from
Date: the day, month, and year when the species record was collected.
: year: The year when the species record was collated.
Locality: particular locality where the species was sampled.
country: The country where the record was made.
Details
BQEs sensitivity to global/climate change in European rivers: implications for reference conditions and pressure-impact-recovery chains (Logez et al. 2012). An extract has been made for usage in this package but for more information write to ihg@boku.ac.at
References
Logez M, Belliard J, Melcher A, Kremser H, Pletterbauer F, Schmutz S, Gorges G, Delaigue O, Pont D. 2012. Deliverable D5.1-3: BQEs sensitivity to global/climate change in European rivers: implications for reference conditions and pressure-impact-recovery chains.
Examples
## Not run:
data("speciesdata")
speciesdata
## End(Not run)