Title: | Data Access and Analytical Tools for 'VectorSurv' Users |
---|---|
Description: | Allows registered 'VectorSurv' <https://vectorsurv.org/> users access to data through the 'VectorSurv API' <https://api.vectorsurv.org/>. Additionally provides functions for analysis and visualization. |
Authors: | Christina De Cesaris [aut, cre] |
Maintainer: | Christina De Cesaris <[email protected]> |
License: | GPL-3 |
Version: | 1.3.0 |
Built: | 2025-02-06 07:03:19 UTC |
Source: | CRAN |
Calculates abundance
getAbundance( collections, interval, species = NULL, trap = NULL, sex = "female", separate_by = NULL )
getAbundance( collections, interval, species = NULL, trap = NULL, sex = "female", separate_by = NULL )
collections |
Collections data retrieved from getArthroCollections() |
interval |
Calculation interval for abundance, accepts “collection_date”,“Biweek”,“Week”, and “Month. |
species |
An optional vector for filtering species. Species_display_name is the accepted notation.To see a list of species present in your data run unique(collections$species_display_name). If species is unspecified, the default NULL will return data for all species in data. |
trap |
An optional vector for filtering trap type by acronym. Trap_acronym is the is the accepted notation. Run unique(collections$trap_acronym) to see trap types present in your data. If trap is unspecified, the default NULL will return data for all trap types. |
sex |
An optional vector for filtering sex type. Accepts 'male', 'female',or 'other'. If sex is unspecified, the default NULL will return data for female sex. |
separate_by |
Separate/group the calculation by 'trap','species' or 'agency'. Default NULL does not separate. |
A dataframe of abundance calculations.
getAbundance(sample_collections, interval = 'Week', species = list('Cx pipiens'), trap = list('GRVD', 'CO2'), sex = list("female"), separate_by = "species")
getAbundance(sample_collections, interval = 'Week', species = list('Cx pipiens'), trap = list('GRVD', 'CO2'), sex = list("female"), separate_by = "species")
'getAbundanceAnomaly(...) 'requires at least five years prior to the target_year of arthro collections data to calculate for the specified parameters. The function uses the methods of the Gateway Abundance Anomaly calculator, and will not work if there is fewer than five years of data present.
getAbundanceAnomaly( collections, interval, target_year, species = NULL, trap = NULL, sex = "female", separate_by = NULL )
getAbundanceAnomaly( collections, interval, target_year, species = NULL, trap = NULL, sex = "female", separate_by = NULL )
collections |
Collections data retrieved from 'getArthroCollections()' |
interval |
Calculation interval for abundance, accepts “collection_date”,“Biweek”,“Week”, and “Month |
target_year |
Year to calculate analysis on. Collections data must have a year range of at least (target_year - 5, target_year) |
species |
An optional vector for filtering species. Species_display_name is the accepted notation.To see a list of species present in your data run unique(collections$species_display_name). If species is unspecified, the default NULL will return data for all species in data. |
trap |
An optional vector for filtering trap type by acronym. Trap_acronym is the is the accepted notation. Run unique(collections$trap_acronym) to see trap types present in your data. If trap is unspecified, the default NULL will return data for all trap types. |
sex |
An optional vector for filtering sex type. Accepts 'male', 'female',or 'other'. If sex is unspecified, the default NULL will return data for female sex. |
separate_by |
Separate/group the calculation by 'trap','species' or 'agency'. Default NULL does not separate. |
Abundance anomaly calculation
getAbundanceAnomaly(sample_collections,"Biweek",target_year=2020, species="Cx pipiens")
getAbundanceAnomaly(sample_collections,"Biweek",target_year=2020, species="Cx pipiens")
'getArthroCollections()' obtains collections data on a year range [start_year, end_year] for authorized VectorSurv Gateway accounts.
getArthroCollections(token, start_year, end_year, arthropod, agency_ids = NULL)
getArthroCollections(token, start_year, end_year, arthropod, agency_ids = NULL)
token |
A valid access token returned from 'getToken()' |
start_year |
Start year of data |
end_year |
End year of data |
arthropod |
Specify arthropod type from: 'mosquito', 'tick' |
agency_ids |
Filter on agency id, default to NULL for all available agencies,otherwise provide a vector of agency ids |
A dataframe of collections
## Not run: token = getToken() collections = getArthroCollections(token, 2021, 2022, 'mosquito',55, TRUE) ## End(Not run)
## Not run: token = getToken() collections = getArthroCollections(token, 2021, 2022, 'mosquito',55, TRUE) ## End(Not run)
'getInfectionRate()' requires at least five years prior to the target_year of arthro collections data to calculate for the specified parameters. The function uses the methods of the Gateway Abundance Anomaly calculator, and will not work if there is fewer than five years of data present.
getInfectionRate( pools, interval, target_disease, pt_estimate, scale = 1000, species = NULL, trap = NULL, sex = "female", separate_by = NULL, wide = FALSE )
getInfectionRate( pools, interval, target_disease, pt_estimate, scale = 1000, species = NULL, trap = NULL, sex = "female", separate_by = NULL, wide = FALSE )
pools |
Pools data retrieved from 'getPools()' |
interval |
Calculation interval for infection rate, accepts “collection_date”,“Biweek”,“Week”, and “Month |
target_disease |
The disease to calculate infection rate for–i.e. “WNV”. Disease acronyms are the accepted input. To see a list of disease acronyms, run 'unique(pools$target_acronym)' |
pt_estimate |
The estimation type for infection rate. Options include: “mle”,“bc-mle”, “mir” |
scale |
Constant to multiply infection rate by |
species |
An optional vector for filtering species. Species_display_name is the accepted notation.To see a list of species present in your data run unique(collections$species_display_name). If species is unspecified, the default NULL will return data for all species in data. |
trap |
An optional vector for filtering trap type by acronym. Trap_acronym is the is the accepted notation. Run unique(collections$trap_acronym) to see trap types present in your data. If trap is unspecified, the default NULL will return data for all trap types. |
sex |
An optional vector for filtering sex type. Accepts 'male', 'female',or 'other'. If sex is unspecified, the default NULL will return data for female sex. |
separate_by |
Separate/group the calculation by 'trap','species' or 'agency'. Default NULL does not separate. |
wide |
Should the data be returned in wide/spreadsheet format |
Dataframe of infection rate calculation
Retrieves VectorSurv pools data for desired year range
getPools(token, start_year, end_year, arthropod, agency_ids = NULL)
getPools(token, start_year, end_year, arthropod, agency_ids = NULL)
token |
access token retrived from 'getToken()' |
start_year |
Beginning of year range |
end_year |
End of year range |
arthropod |
Specify arthropod type from: 'mosquito', 'tick', 'nontick' |
agency_ids |
Filter on agency id, default to NULL for all available agencies,otherwise provide a vector of agency ids |
Dataframe of pools data
## Not run: token = getToken() getPools(token, start_year = 2020, end_year = 2021, arthropod = 'tick', 55) ## End(Not run)
## Not run: token = getToken() getPools(token, start_year = 2020, end_year = 2021, arthropod = 'tick', 55) ## End(Not run)
'getPoolsComparisionTable()' produces a frequency table for positive, negative, and pending pools counts by year and species. The more years present in the data, the larger the table.
getPoolsComparisionTable(pools, interval, target_disease, separate_by = NULL)
getPoolsComparisionTable(pools, interval, target_disease, separate_by = NULL)
pools |
Pools data retrieved from 'getPools()' |
interval |
Calculation interval for comparison table, accepts “collection_date”,“Biweek”,“Week”, and “Month |
target_disease |
The disease to calculate infection rate for–i.e. “WNV”. Disease acronyms are the accepted input. To see a list of disease acronyms, run 'unique(pools$target_acronym)' |
separate_by |
Separate/group the calculation by 'trap','species' or 'agency'. Default NULL does not separate. |
Frequency table of for pools data
getPoolsComparisionTable(sample_pools, interval = "Biweek", target_disease = "WNV", separate_by = "species")
getPoolsComparisionTable(sample_pools, interval = "Biweek", target_disease = "WNV", separate_by = "species")
'getSites()' obtains site data for authorized VectorSurv Gateway accounts.
getRegions(token)
getRegions(token)
token |
A valid access token returned from 'getToken()' |
A dataframe of region data, used internally to merge spatial information to collections
'getSites()' obtains site data for authorized VectorSurv Gateway accounts.
getSites(token)
getSites(token)
token |
A valid access token returned from 'getToken()' |
A dataframe of site data
## Not run: token = getToken() sites = getSites(token) ## End(Not run)
## Not run: token = getToken() sites = getSites(token) ## End(Not run)
getToken() returns a token needed to run getArthroCollections() and getPools(). Prints agencies associated with account credentials. The function prompts users for a VectorSurv account credentials.
getToken()
getToken()
User token
## Not run: token = getToken()
## Not run: token = getToken()
'getVectorIndex()'requires at least five years prior to the target_year of arthro collections data to calculate for the specified parameters. The function uses the methods of the Gateway Abundance Anomaly calculator, and will not work if there is fewer than five years of data present.
getVectorIndex( collections, pools, interval, target_disease, pt_estimate, scale = 1000, species = NULL, trap = NULL, sex = NULL, separate_by = NULL, wide = FALSE )
getVectorIndex( collections, pools, interval, target_disease, pt_estimate, scale = 1000, species = NULL, trap = NULL, sex = NULL, separate_by = NULL, wide = FALSE )
collections |
Collections data retrieved from 'getArthroCollections()' |
pools |
Pools data retrieved from 'getPools()' |
interval |
Calculation interval for vector index, accepts “collection_date”,“Biweek”,“Week”, and “Month |
target_disease |
The disease to calculate infection rate for–i.e. “WNV”. Disease acronyms are the accepted input. To see a list of disease acronyms, run 'unique(pools$target_acronym)' |
pt_estimate |
The estimation type for infection rate. Options include: “mle”,“bc-”mle”, “mir” |
scale |
Constant to multiply infection rate, default is 1000 |
species |
An optional vector for filtering species. Species_display_name is the accepted notation.To see a list of species present in your data run unique(collections$species_display_name). If species is unspecified, the default NULL will return data for all species in data. |
trap |
An optional vector for filtering trap type by acronym. Trap_acronym is the is the accepted notation. Run unique(collections$trap_acronym) to see trap types present in your data. If trap is unspecified, the default NULL will return data for all trap types. |
sex |
An optional vector for filtering sex type. Accepts 'male', 'female',or 'other'. If sex is unspecified, the default NULL will return data for female sex. |
separate_by |
Separate/group the calculation by 'trap','species' or 'agency'. Default NULL does not separate. |
wide |
Should the data be returned in wide/spreadsheet format |
Dataframe containing the vector index calculation
getVectorIndex(sample_collections, sample_pools, "Month", "WNV", "mle", wide = FALSE )
getVectorIndex(sample_collections, sample_pools, "Month", "WNV", "mle", wide = FALSE )
‘processAbunAnom()' processes the output returned from 'getAbundanceAnomaly()' into a long form suitable for plotting using ’ggplot'
processAbunAnom(AbAnomOutput)
processAbunAnom(AbAnomOutput)
AbAnomOutput |
output from 'getAbunAnom()' |
Abundance anomaly output processed into long form, used for plotting functions
Sample Mosquito Collections data imitates the essential components of real mosquito collections data
sample_collections
sample_collections
A data frame with 2500 rows and 13 variables:
agency_code
character Four letter agency code
collection_id
double Collection identification number
collection_date
character The date the trap was picked up for collection
num_trap
integer The number of unique traps in operation at one site
site_code
integer Identifying code of site
surv_year
double Surveillance year of collection
trap_nights
integer The number of nights a trap was in the field
trap_problem_bit
logical If these was an issue with the trap
num_count
integer Number of arthropods present in collection
sex_type
character Sex of collected arthropods
species_display_name
character Species name of collected arthropods
trap_acronym
character The acronym of the trap placed in the field
Sample Pools data imitates the essential components of real mosquito pools data needed for calculations
sample_pools
sample_pools
A data frame with 2500 rows and 10 variables:
agency_code
character Four letter agency code
pool_id
integer Pool identification number
surv_year
integer Surveillance year of pool
site_code
integer Identifying code of site
collection_date
character The date the trap was picked up for collection
sex_type
integer Sex type of collected arthropods
num_count
integer Number of arthropods present in collection
target_acronym
character The disease being tested for in the pool
method_name
character Method used to test pool for disease
status_name
character Status of the tested disease, confirmed or negative
trap_acronym
character The acronym of the trap placed in the field
species_display_name
character Species name of collected arthropods