# vectorsurvR

## VectorSurv

VectorSurv provides public health agencies the tools to manage, visualize and analyze the spread of vector-borne diseases and make informed decisions to protect public health.

The ‘vectorsurvR’ package is intended for users of VectorSurv, a public health vector borne disease surveillance system. The package contains functions tailored to data retrieved from the VectorSurv database. A valid VectorSurv username and password is required for data retrieval. Those without agency access can use sample datasets in place of real data. This documentation covers the functions in ‘vectorsurvR’ and introduces users to methods of R programming. The purpose of this documentation is to introduce and guide users with limited programming experience.

To install package from CRAN (recommended) run:

`install.packages("vectorsurvR")`

Or install the developing version from our github run:

`devtools::install_github("UCD-DART/vectorsurvR")`

Then load the package for use.

## Data Retrieval

getToken()

Description

`getToken()` returns a token needed to run `getArthroCollections()` and `getPools()`. The function prompts users for their Gateway credentials. If credentials are accepted, the function returns a user token needed to obtain data and a list of agencies the user has access to.

Usage

`getToken()`

Arguments

    token = getToken()

getArthroCollections(…)

Description

`getArthroCollections(...)` obtains collections data for a range of years. It prompts the user for their Gateway username and password before retrieving the associated data. You can only retrieve data from agencies linked to your Gateway account.

Usage

`getArthroCollections(token,start_year, end_year, arthropod, agency_ids = NULL)`

Arguments

- token: access token retrieved from `getToken()`
- start_year: Beginning of year range
- end_year: End of year range
- arthropod: Type of pools to retrieve: ‘tick’ , ‘mosquito’
- agency_ids: Default to NULL returns data for all available agencies, specifying a vector of agency ids will return data for specific agencies. This parameter is best used by accounts with access to multiple agencies.

    #Example
    collections = getArthroCollections(token, 2022,2023, 'mosquito',55)

getPools(…)

Description

`getPools()` similar to `getArthroCollections()` obtains pools on a year range (start_year, end_year) after supplying a valid token retrieved from getToken(). `getPools()` can retrieve data for both mosquito and tick pools.

Usage

`getPools(token, start_year, end_year, arthropod, agency_ids = NULL)` Arguments

- token: access token retrieved from `getToken()`
- start_year: Beginning of year range
- end_year: End of year range
- arthropod: Type of collections to retrieve: ‘tick’ , ‘mosquito’
- agency_ids: Default to NULL returns data for all available agencies, specifying a vector of agency ids will return data for specific agencies. This parameter is best used by accounts with access to multiple agencies.

    #Example
    pools = getPools(token, 2022,2023, 'mosquito')

## Write Data to file

You can save retrieved data as a .csv file in your current directory using `write.csv()`. That same data can be retrieved using `read.csv()`. Writing data to a .csv can make the rendering process more efficient when generating reports in R. We recommend that you write the data pulled from our API into a csv and then load that data when generating reports.

    #creates a file named "collections_18_23.csv" in your current directory
    write.csv(x = collections, file = "collections_22_23.csv")

    #loads collections data
    collections = read.csv("collections_22_23.csv")

## Sample Data

The ‘vectorsurvR’ package comes with two sample datasets which can be used in place of real collections and pools data. `sample_collections` and `sample_pools` will be used for example purposes in this document.

## Data Processing

Data can be subset to contain columns of interest. Subsetting can also be used to reorder the columns in a data frame.Do not subset collections or pools data before inputting them into VectorSurv calculator functions to avoid losing essential columns. It is recommended to subset after calculations are complete and before inputting into a table generator. Remember, subsetting, filtering, grouping and summarising will not change the value of the data unless it is reassigned to the same variable name. We recommend creating a new variable for processed data.

### Subsetting

    #Subset using column names or index number

    colnames(sample_collections) #displays column names and associated index
    #>  [1] "agency_code"          "collection_id"        "collection_date"
    #>  [4] "surv_year"            "species_display_name" "sex_type"
    #>  [7] "trap_acronym"         "trap_problem_bit"     "num_trap"
    #> [10] "trap_nights"          "num_count"            "site_code"
    #> [13] "collection_longitude" "collection_latitude"

    #Subseting by name
    head(sample_collections[c("collection_date", "species_display_name", "num_count")])
    #> # A tibble: 6 × 3
    #>   collection_date species_display_name num_count
    #>   <date>          <chr>                    <int>
    #> 1 2015-01-22      Cx pipiens                   1
    #> 2 2015-01-10      Cx stigmatosoma              2
    #> 3 2015-01-02      Cs inornata                  1
    #> 4 2015-01-02      Cs inornata                 22
    #> 5 2015-01-29      Cs inornata                 38
    #> 6 2015-01-29      Cs incidens                  2

    #by index
    head(sample_collections[c(2, 4, 10)])
    #> # A tibble: 6 × 3
    #> # Groups:   surv_year [1]
    #>   collection_id surv_year trap_nights
    #>           <int>     <dbl>       <int>
    #> 1       1374818      2015           6
    #> 2       1368247      2015           8
    #> 3       1366915      2015          15
    #> 4       1366929      2015          15
    #> 5       1377676      2015           7
    #> 6       1377690      2015           7

    #to save a subset
    collections_subset = sample_collections[c(2, 4, 10)]

### Filtering and subsetting in ‘dplyr’

‘dplyr’ is a powerful package for filtering and sub-setting data. It follows logic similar to SQL queries.

For more information on data manipulation using ‘dplyr’ Click Here

‘dplyr’ utilizes the pipe operator `%>%` to send data into functions. The `head()` function returns the first few rows of data, specifying `head(1)` tells the software to return only the first row for viewing purposes. Remove `head()` to see all the data or reassign the data to a new variable.

    #NOTE: library was loaded above
    library(dplyr)

    #Subsetting columns with 'select()'
    sample_collections %>%
      dplyr::select(collection_date, species_display_name, num_count) %>% head()
    #> Adding missing grouping variables: `surv_year`
    #> # A tibble: 6 × 4
    #> # Groups:   surv_year [1]
    #>   surv_year collection_date species_display_name num_count
    #>       <dbl> <date>          <chr>                    <int>
    #> 1      2015 2015-01-22      Cx pipiens                   1
    #> 2      2015 2015-01-10      Cx stigmatosoma              2
    #> 3      2015 2015-01-02      Cs inornata                  1
    #> 4      2015 2015-01-02      Cs inornata                 22
    #> 5      2015 2015-01-29      Cs inornata                 38
    #> 6      2015 2015-01-29      Cs incidens                  2

Below are more examples for filtering data.

    #filtering with dplyr 'filter'
    collections_pip = sample_collections %>%
      filter(species_display_name == "Cx pipiens")

    #filtering multiple arguments using '%in%'
    collections_pip_tar = sample_collections %>%
      filter(species_display_name %in% c("Cx pipiens", "Cx tarsalis"))

### Grouping and Summarising

In addition to filtering and sub-setting, data can be group by variables and summarized.

    #groups by species and collection date and sums the number counted

    sample_collections %>%
      group_by(collection_date, species_display_name) %>%
      summarise(sum_count = sum(num_count, na.rm = T)) %>%
      head()
    #> `summarise()` has grouped output by 'collection_date'. You can override using
    #> the `.groups` argument.
    #> # A tibble: 6 × 3
    #> # Groups:   collection_date [2]
    #>   collection_date species_display_name sum_count
    #>   <date>          <chr>                    <int>
    #> 1 2015-01-02      Cs incidens                 15
    #> 2 2015-01-02      Cs inornata                 88
    #> 3 2015-01-02      Cx pipiens                  46
    #> 4 2015-01-02      Cx tarsalis                  3
    #> 5 2015-01-10      An freeborni                 4
    #> 6 2015-01-10      Cs incidens                  1

    #groups by species and collection date and takes the average the number counted

    sample_collections %>%
      group_by(collection_date, species_display_name) %>%
      summarise(avg_count = mean(num_count, na.rm = T)) %>%
      head()
    #> `summarise()` has grouped output by 'collection_date'. You can override using
    #> the `.groups` argument.
    #> # A tibble: 6 × 3
    #> # Groups:   collection_date [2]
    #>   collection_date species_display_name avg_count
    #>   <date>          <chr>                    <dbl>
    #> 1 2015-01-02      Cs incidens                5
    #> 2 2015-01-02      Cs inornata                8
    #> 3 2015-01-02      Cx pipiens                11.5
    #> 4 2015-01-02      Cx tarsalis                1.5
    #> 5 2015-01-10      An freeborni               4
    #> 6 2015-01-10      Cs incidens                1

### Pivoting

Data can be manipulated into long and wide (spreadsheet) forms using `pivot_wider()` and `pivot_longer()` from the ‘tidyr’ package. By default data from the API is in long form. Here we pivot on species and sex condition names using num_count as values. The end result is data with num_count values in the columns named species_sex. For more on pivoting see `??pivot_longer()` and `??pivot_wider()`.

    library(tidyr)

    collections_wide = pivot_wider(
      sample_collections,
      names_from = c("species_display_name","sex_type"),
      values_from = "num_count"
    )
    #> Warning: Values from `num_count` are not uniquely identified; output will contain
    #> list-cols.
    #> • Use `values_fn = list` to suppress this warning.
    #> • Use `values_fn = {summary_fun}` to summarise duplicates.
    #> • Use the following dplyr code to identify duplicates.
    #>   {data} |>
    #>   dplyr::summarise(n = dplyr::n(), .by = c(agency_code, collection_id,
    #>   collection_date, surv_year, trap_acronym, trap_problem_bit, num_trap,
    #>   trap_nights, site_code, collection_longitude, collection_latitude,
    #>   species_display_name, sex_type)) |>
    #>   dplyr::filter(n > 1L)

## Calculations

### Abundance

getAbundance(…)

Description

`getAbundance()` uses any amount of mosquito collections data to calculate the abundance for the specified parameters. The function calculates using the methods of the Gateway Abundance calculator.

Usage

`getAbundance(collections,interval, species = NULL, trap = NULL, separate_by = NULL)`

Arguments

- collections: Mosquito collections data retrieved from `getArthroCollections(...)`
- interval: Calculation interval for abundance, accepts “collection_date”,“Biweek”,“Week”, and “Month.
- species: Species filter for calculating abundance. 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: Trap filter for calculating abundance. 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.
- separate_by:Separate/group the calculation by ‘trap’,‘species’ or ‘agency’. Default NULL does not separate calculation

    getAbundance(
      sample_collections,
      interval = "Biweek",
      species = c("Cx tarsalis", "Cx pipiens"),
      trap = "CO2",
      separate_by = NULL
    )
    #>                Agency Year Biweek                 Species Count TrapEvents Trap
    #> 1            Agency_1 2021      4              Cx pipiens    10          3  CO2
    #> 2            Agency_1 2021      7              Cx pipiens     4          3  CO2
    #> 3  Agency_1, Agency_2 2021      8 Cx pipiens, Cx tarsalis    23         10  CO2
    #> 4            Agency_1 2021     10              Cx pipiens     9          5  CO2
    #> 5  Agency_1, Agency_2 2021     11 Cx pipiens, Cx tarsalis    17         13  CO2
    #> 6  Agency_1, Agency_2 2021     12 Cx pipiens, Cx tarsalis   474         10  CO2
    #> 7  Agency_1, Agency_2 2021     13              Cx pipiens   338         12  CO2
    #> 8  Agency_1, Agency_2 2021     14 Cx pipiens, Cx tarsalis    79          9  CO2
    #> 9  Agency_1, Agency_2 2021     15 Cx pipiens, Cx tarsalis  3137         10  CO2
    #> 10 Agency_1, Agency_2 2021     16 Cx pipiens, Cx tarsalis  2265         12  CO2
    #> 11 Agency_1, Agency_2 2021     17 Cx pipiens, Cx tarsalis    23          8  CO2
    #> 12 Agency_1, Agency_2 2021     18             Cx tarsalis    49          6  CO2
    #> 13 Agency_1, Agency_2 2021     19             Cx tarsalis    35         10  CO2
    #> 14 Agency_1, Agency_2 2021     20             Cx tarsalis    39         10  CO2
    #> 15           Agency_1 2021     21 Cx pipiens, Cx tarsalis    16          6  CO2
    #> 16           Agency_2 2020      9             Cx tarsalis    56          4  CO2
    #> 17           Agency_2 2020     10 Cx pipiens, Cx tarsalis    24          6  CO2
    #> 18 Agency_1, Agency_2 2020     11 Cx pipiens, Cx tarsalis   204         15  CO2
    #> 19 Agency_1, Agency_2 2020     12 Cx pipiens, Cx tarsalis   251         10  CO2
    #> 20 Agency_1, Agency_2 2020     13 Cx pipiens, Cx tarsalis   208         14  CO2
    #> 21 Agency_1, Agency_2 2020     14 Cx pipiens, Cx tarsalis  2584         12  CO2
    #> 22           Agency_1 2020     15 Cx pipiens, Cx tarsalis    38          8  CO2
    #> 23 Agency_1, Agency_2 2020     16 Cx pipiens, Cx tarsalis   345          8  CO2
    #> 24 Agency_1, Agency_2 2020     17 Cx pipiens, Cx tarsalis  1670         10  CO2
    #> 25 Agency_1, Agency_2 2020     18             Cx tarsalis    79          7  CO2
    #> 26 Agency_1, Agency_2 2020     19 Cx pipiens, Cx tarsalis   187         13  CO2
    #> 27           Agency_1 2020     20             Cx tarsalis    43         12  CO2
    #> 28 Agency_1, Agency_2 2020     21 Cx pipiens, Cx tarsalis    61         13  CO2
    #> 29 Agency_1, Agency_2 2020     22 Cx pipiens, Cx tarsalis    12         11  CO2
    #> 30           Agency_1 2020     23 Cx pipiens, Cx tarsalis     9          8  CO2
    #> 31           Agency_1 2020     24              Cx pipiens     3          4  CO2
    #> 32           Agency_1 2019      4              Cx pipiens     3          1  CO2
    #> 33           Agency_1 2019      9 Cx pipiens, Cx tarsalis    18          9  CO2
    #> 34           Agency_1 2019     10 Cx pipiens, Cx tarsalis    22          7  CO2
    #> 35 Agency_1, Agency_2 2019     11 Cx pipiens, Cx tarsalis   564         16  CO2
    #> 36 Agency_1, Agency_2 2019     12              Cx pipiens    51          4  CO2
    #> 37 Agency_1, Agency_2 2019     13 Cx pipiens, Cx tarsalis   881         13  CO2
    #> 38           Agency_2 2019     14 Cx pipiens, Cx tarsalis   266          6  CO2
    #> 39 Agency_1, Agency_2 2019     15 Cx pipiens, Cx tarsalis  4239         16  CO2
    #> 40 Agency_1, Agency_2 2019     16 Cx pipiens, Cx tarsalis    68         14  CO2
    #> 41 Agency_1, Agency_2 2019     17 Cx pipiens, Cx tarsalis    77          7  CO2
    #> 42           Agency_1 2019     18 Cx pipiens, Cx tarsalis   262          6  CO2
    #> 43 Agency_1, Agency_2 2019     19 Cx pipiens, Cx tarsalis    54          9  CO2
    #> 44           Agency_1 2019     20 Cx pipiens, Cx tarsalis   214         12  CO2
    #> 45           Agency_2 2019     21             Cx tarsalis    37          9  CO2
    #> 46 Agency_1, Agency_2 2018     10 Cx pipiens, Cx tarsalis   304         16  CO2
    #> 47 Agency_1, Agency_2 2018     11 Cx pipiens, Cx tarsalis    96         16  CO2
    #> 48 Agency_1, Agency_2 2018     12 Cx pipiens, Cx tarsalis    90         16  CO2
    #> 49 Agency_1, Agency_2 2018     13 Cx pipiens, Cx tarsalis  4016         13  CO2
    #> 50 Agency_1, Agency_2 2018     14 Cx pipiens, Cx tarsalis   486          9  CO2
    #> 51 Agency_1, Agency_2 2018     15 Cx pipiens, Cx tarsalis   147         11  CO2
    #> 52 Agency_1, Agency_2 2018     16 Cx pipiens, Cx tarsalis  1611         14  CO2
    #> 53           Agency_1 2018     17 Cx pipiens, Cx tarsalis    41         13  CO2
    #> 54 Agency_1, Agency_2 2018     18 Cx pipiens, Cx tarsalis   211         13  CO2
    #> 55 Agency_1, Agency_2 2018     19              Cx pipiens   125         10  CO2
    #> 56 Agency_1, Agency_2 2018     20 Cx pipiens, Cx tarsalis    47         10  CO2
    #> 57 Agency_1, Agency_2 2018     21             Cx tarsalis    11          9  CO2
    #> 58           Agency_1 2017      8              Cx pipiens    10          4  CO2
    #> 59           Agency_1 2017      9 Cx pipiens, Cx tarsalis    18          8  CO2
    #> 60 Agency_1, Agency_2 2017     10 Cx pipiens, Cx tarsalis   149         16  CO2
    #> 61 Agency_1, Agency_2 2017     11 Cx pipiens, Cx tarsalis   351         13  CO2
    #> 62 Agency_1, Agency_2 2017     12 Cx pipiens, Cx tarsalis    65         17  CO2
    #> 63 Agency_1, Agency_2 2017     13 Cx pipiens, Cx tarsalis   209         19  CO2
    #> 64 Agency_1, Agency_2 2017     14 Cx pipiens, Cx tarsalis   410         23  CO2
    #> 65 Agency_1, Agency_2 2017     15 Cx pipiens, Cx tarsalis   669         10  CO2
    #> 66 Agency_1, Agency_2 2017     16 Cx pipiens, Cx tarsalis  2574         13  CO2
    #> 67 Agency_1, Agency_2 2017     17 Cx pipiens, Cx tarsalis  4535         22  CO2
    #> 68 Agency_1, Agency_2 2017     18 Cx pipiens, Cx tarsalis   462         17  CO2
    #> 69 Agency_1, Agency_2 2017     19 Cx pipiens, Cx tarsalis   144         10  CO2
    #> 70 Agency_1, Agency_2 2017     20 Cx pipiens, Cx tarsalis    49         22  CO2
    #> 71 Agency_1, Agency_2 2017     21             Cx tarsalis   138         16  CO2
    #> 72           Agency_1 2016      8             Cx tarsalis    68         12  CO2
    #> 73           Agency_1 2016      9 Cx pipiens, Cx tarsalis    13         11  CO2
    #> 74 Agency_1, Agency_2 2016     10 Cx pipiens, Cx tarsalis   323          9  CO2
    #> 75 Agency_1, Agency_2 2016     11 Cx pipiens, Cx tarsalis    52         15  CO2
    #> 76 Agency_1, Agency_2 2016     12 Cx pipiens, Cx tarsalis   559         26  CO2
    #> 77 Agency_1, Agency_2 2016     13 Cx pipiens, Cx tarsalis  1189         21  CO2
    #> 78           Agency_1 2016     14 Cx pipiens, Cx tarsalis    94         10  CO2
    #> 79 Agency_1, Agency_2 2016     15 Cx pipiens, Cx tarsalis  2198         18  CO2
    #> 80 Agency_1, Agency_2 2016     16 Cx pipiens, Cx tarsalis  1128         10  CO2
    #> 81 Agency_1, Agency_2 2016     17 Cx pipiens, Cx tarsalis  1107         18  CO2
    #> 82 Agency_1, Agency_2 2016     18 Cx pipiens, Cx tarsalis   330         16  CO2
    #> 83 Agency_1, Agency_2 2016     19 Cx pipiens, Cx tarsalis   160         17  CO2
    #> 84 Agency_1, Agency_2 2016     20 Cx pipiens, Cx tarsalis    38         16  CO2
    #> 85 Agency_1, Agency_2 2016     21 Cx pipiens, Cx tarsalis     8          9  CO2
    #> 86 Agency_1, Agency_2 2015      8              Cx pipiens     8          6  CO2
    #> 87           Agency_1 2015      9 Cx pipiens, Cx tarsalis    12         10  CO2
    #> 88 Agency_1, Agency_2 2015     10 Cx pipiens, Cx tarsalis   612         27  CO2
    #> 89 Agency_1, Agency_2 2015     11 Cx pipiens, Cx tarsalis   318         19  CO2
    #> 90 Agency_1, Agency_2 2015     12 Cx pipiens, Cx tarsalis   737         16  CO2
    #> 91 Agency_1, Agency_2 2015     13 Cx pipiens, Cx tarsalis   405         17  CO2
    #> 92 Agency_1, Agency_2 2015     14 Cx pipiens, Cx tarsalis   531         15  CO2
    #> 93 Agency_1, Agency_2 2015     15 Cx pipiens, Cx tarsalis   780         10  CO2
    #> 94 Agency_1, Agency_2 2015     16 Cx pipiens, Cx tarsalis   805         18  CO2
    #> 95 Agency_1, Agency_2 2015     17 Cx pipiens, Cx tarsalis  2433         15  CO2
    #> 96 Agency_1, Agency_2 2015     18 Cx pipiens, Cx tarsalis  2056         20  CO2
    #> 97 Agency_1, Agency_2 2015     19 Cx pipiens, Cx tarsalis   164         17  CO2
    #> 98 Agency_1, Agency_2 2015     20 Cx pipiens, Cx tarsalis   569         22  CO2
    #> 99           Agency_1 2015     21              Cx pipiens    45          5  CO2
    #>    Abundance
    #> 1       3.33
    #> 2       1.33
    #> 3       2.30
    #> 4       1.80
    #> 5       1.31
    #> 6      47.40
    #> 7      28.17
    #> 8       8.78
    #> 9     313.70
    #> 10    188.75
    #> 11      2.88
    #> 12      8.17
    #> 13      3.50
    #> 14      3.90
    #> 15      2.67
    #> 16     14.00
    #> 17      4.00
    #> 18     13.60
    #> 19     25.10
    #> 20     14.86
    #> 21    215.33
    #> 22      4.75
    #> 23     43.12
    #> 24    167.00
    #> 25     11.29
    #> 26     14.38
    #> 27      3.58
    #> 28      4.69
    #> 29      1.09
    #> 30      1.12
    #> 31      0.75
    #> 32      3.00
    #> 33      2.00
    #> 34      3.14
    #> 35     35.25
    #> 36     12.75
    #> 37     67.77
    #> 38     44.33
    #> 39    264.94
    #> 40      4.86
    #> 41     11.00
    #> 42     43.67
    #> 43      6.00
    #> 44     17.83
    #> 45      4.11
    #> 46     19.00
    #> 47      6.00
    #> 48      5.62
    #> 49    308.92
    #> 50     54.00
    #> 51     13.36
    #> 52    115.07
    #> 53      3.15
    #> 54     16.23
    #> 55     12.50
    #> 56      4.70
    #> 57      1.22
    #> 58      2.50
    #> 59      2.25
    #> 60      9.31
    #> 61     27.00
    #> 62      3.82
    #> 63     11.00
    #> 64     17.83
    #> 65     66.90
    #> 66    198.00
    #> 67    206.14
    #> 68     27.18
    #> 69     14.40
    #> 70      2.23
    #> 71      8.62
    #> 72      5.67
    #> 73      1.18
    #> 74     35.89
    #> 75      3.47
    #> 76     21.50
    #> 77     56.62
    #> 78      9.40
    #> 79    122.11
    #> 80    112.80
    #> 81     61.50
    #> 82     20.62
    #> 83      9.41
    #> 84      2.38
    #> 85      0.89
    #> 86      1.33
    #> 87      1.20
    #> 88     22.67
    #> 89     16.74
    #> 90     46.06
    #> 91     23.82
    #> 92     35.40
    #> 93     78.00
    #> 94     44.72
    #> 95    162.20
    #> 96    102.80
    #> 97      9.65
    #> 98     25.86
    #> 99      9.00

### Abundance Anomaly (comparison to 5 year average)

getAbundanceAnomaly()

Description

`getAbundanceAnomaly(...)` requires at least five years prior to the target_year of mosquito 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.

Usage

`getAbundanceAnomaly(collections,interval,target_year, species = NULL, trap = NULL, separate_by = NULL)`

Arguments

- 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: Species filter for calculating abundance. 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: Trap filter for calculating abundance. 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.
- separate_by:Separate/group the calculation by ‘trap’,‘species’ or ‘agency’. Default NULL does not separate calculation

    getAbundanceAnomaly(sample_collections,
                        interval = "Biweek",
                        target_year = 2020,
                        species = c("Cx tarsalis", "Cx pipiens"),
                        trap = "CO2",
                        separate_by  = "species")
    #> Warning in getAbundanceAnomaly(sample_collections, interval = "Biweek", : There
    #> are years greater than the target year in the data. These years will not be
    #> included in the anomaly calculation.
    #>    Biweek     Species             Agency Year Count TrapEvents Trap Abundance
    #> 1      10  Cx pipiens           Agency_2 2020     1          6  CO2      0.17
    #> 2      10 Cx tarsalis           Agency_2 2020    23          6  CO2      3.83
    #> 3      11  Cx pipiens Agency_1, Agency_2 2020    24         15  CO2      1.60
    #> 4      11 Cx tarsalis Agency_1, Agency_2 2020   180         15  CO2     12.00
    #> 5      12  Cx pipiens           Agency_1 2020     5         10  CO2      0.50
    #> 6      12 Cx tarsalis Agency_1, Agency_2 2020   246         10  CO2     24.60
    #> 7      13  Cx pipiens Agency_1, Agency_2 2020    93         14  CO2      6.64
    #> 8      13 Cx tarsalis Agency_1, Agency_2 2020   115         14  CO2      8.21
    #> 9      14  Cx pipiens Agency_1, Agency_2 2020   287         12  CO2     23.92
    #> 10     14 Cx tarsalis Agency_1, Agency_2 2020  2297         12  CO2    191.42
    #> 11     15  Cx pipiens           Agency_1 2020    29          8  CO2      3.62
    #> 12     15 Cx tarsalis           Agency_1 2020     9          8  CO2      1.12
    #> 13     16  Cx pipiens Agency_1, Agency_2 2020    87          8  CO2     10.88
    #> 14     16 Cx tarsalis           Agency_2 2020   258          8  CO2     32.25
    #> 15     17  Cx pipiens Agency_1, Agency_2 2020    13         10  CO2      1.30
    #> 16     17 Cx tarsalis Agency_1, Agency_2 2020  1657         10  CO2    165.70
    #> 17     18 Cx tarsalis Agency_1, Agency_2 2020    79          7  CO2     11.29
    #> 18     19  Cx pipiens           Agency_1 2020    44         13  CO2      3.38
    #> 19     19 Cx tarsalis Agency_1, Agency_2 2020   143         13  CO2     11.00
    #> 20     20 Cx tarsalis           Agency_1 2020    43         12  CO2      3.58
    #> 21     21  Cx pipiens           Agency_1 2020    31         13  CO2      2.38
    #> 22     21 Cx tarsalis Agency_1, Agency_2 2020    30         13  CO2      2.31
    #> 23      9 Cx tarsalis           Agency_2 2020    56          4  CO2     14.00
    #>    FiveYearAvg           YearsInAverage   Delta
    #> 1       1.8820 2015,2016,2017,2018,2019  -90.97
    #> 2      16.1200 2015,2016,2017,2018,2019  -76.24
    #> 3       2.3260 2015,2016,2017,2018,2019  -31.21
    #> 4      15.3640 2015,2016,2017,2018,2019  -21.90
    #> 5       5.3240 2015,2016,2017,2018,2019  -90.61
    #> 6      15.7850      2015,2016,2017,2018   55.84
    #> 7       5.8140 2015,2016,2017,2018,2019   14.21
    #> 8      87.8140 2015,2016,2017,2018,2019  -90.65
    #> 9       4.8300 2015,2016,2017,2018,2019  395.24
    #> 10     27.3620 2015,2016,2017,2018,2019  599.58
    #> 11     22.2620 2015,2016,2017,2018,2019  -83.74
    #> 12     86.8040 2015,2016,2017,2018,2019  -98.71
    #> 13     26.9020 2015,2016,2017,2018,2019  -59.56
    #> 14     68.1900 2015,2016,2017,2018,2019  -52.71
    #> 15      8.8460 2015,2016,2017,2018,2019  -85.30
    #> 16     79.9520 2015,2016,2017,2018,2019  107.25
    #> 17     28.9700 2015,2016,2017,2018,2019  -61.03
    #> 18      7.6160 2015,2016,2017,2018,2019  -55.62
    #> 19      3.4675      2015,2016,2017,2019  217.23
    #> 20      3.8240 2015,2016,2017,2018,2019   -6.38
    #> 21      4.5550                2015,2016  -47.75
    #> 22      3.6825      2016,2017,2018,2019  -37.27
    #> 23      0.7375      2015,2016,2017,2019 1798.31

### Infection Rate

getInfectionRate()

Description

`getInfectionRate(...)` estimates the arbovirus infection rate based on testing pools of mosquitoes.

Usage

`getInfectionRate(pools,interval, target_year, target_disease,pt_estimate, scale = 1000, species = c(NULL), trap = c(NULL))`

Arguments

- pools: Pools data retrieved from `getPools(...)`
- interval: Calculation interval for abundance, accepts: “Biweek”,“Week”, and “Month.
- target_year: Year to calculate infection rate for. This year must be present in the data.
- 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 result
- species: Species filter for calculating abundance. Species_display_name is the accepted notation. To see a list of species present in your data run `unique(pools$species_display_name)`. If species is unspecified, the default `NULL` will return data for all species in data.
- trap: Trap filter for calculating abundance. Trap_acronym is the is the accepted notation. Run `unique(pools$trap_acronym)` to see trap types present in your data. If trap is unspecified, the default `NULL` will return data for all trap types.
- wide: T/F Should the data be returned in wide/spreadsheet format

    getInfectionRate(sample_pools,
                          interval = "Week",
                          target_disease = "WNV",
                          pt_estimate = "mle",
                          scale = 1000,
                          species = c("Cx pipiens", "Cx tarsalis"),
                          trap = c("CO2"),
                          separate_by="species", wide = FALSE )
    #> # A tibble: 275 × 9
    #> # Groups:   Year, Week [160]
    #>     Year  Week Agency        Species Trap  Disease InfectionRate LowerCI UpperCI
    #>    <dbl> <dbl> <chr>         <chr>   <chr> <chr>           <dbl>   <dbl>   <dbl>
    #>  1  2015    18 Agency_1      Cx pip… CO2   WNV                 0       0       0
    #>  2  2015    18 Agency_1      Cx tar… CO2   WNV                 0       0       0
    #>  3  2015    19 Agency_1      Cx pip… CO2   WNV                 0       0       0
    #>  4  2015    20 Agency_1      Cx tar… CO2   WNV                 0       0       0
    #>  5  2015    21 Agency_1      Cx pip… CO2   WNV                 0       0       0
    #>  6  2015    21 Agency_1      Cx tar… CO2   WNV                 0       0       0
    #>  7  2015    22 Agency_1      Cx pip… CO2   WNV                 0       0       0
    #>  8  2015    22 Agency_1      Cx tar… CO2   WNV                 0       0       0
    #>  9  2015    23 Agency_1      Cx pip… CO2   WNV                 0       0       0
    #> 10  2015    23 Agency_1, Ag… Cx tar… CO2   WNV                 0       0       0
    #> # ℹ 265 more rows

### Vector Index

getVectorIndex()

Description

`getVectorIndex(...)` The vector index is the relative abundance of infected mosquitoes and is a way to quickly estimate the risk of arbovirus transmission in an area. Vector index is the product of the abundance and infection rate for a given time interval: \(Vector Index = Infection Rate * Abundance\)

Usage

`getVectorIndex(collections, pools, interval, , target_disease, pt_estimate,species=NULL, trap = NULL,)`

Arguments - collections: collections data retrieved from `getArthroCollections(...)` - pools: Pools data retrieved from `getPools(...)`

Note: Years from pools and collections data must overlap

- interval: Calculation interval for abundance, accepts “collection_date”,“Biweek”,“Week”, and “Month.

- target_disease: The disease to calculate infection rate. 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”.

- species: Species filter for calculating abundance. Species_display_name is the accepted notation. To see a list of species present in your data run `unique(pools$species_display_name)`. If species is unspecified, the default `NULL` will return data for all species in data.

- trap: Trap filter for calculating abundance. Trap_acronym is the is the accepted notation. Run `unique(pools$trap_acronym)` to see trap types present in your data. If trap is unspecified, the default `NULL` will return data for all trap types.

- separate_by:Separate/group the calculation by ‘trap’,‘species’ or ‘agency’. Default NULL does not separate calculation

- wide: T/F Should the data be returned in wide/spreadsheet format

    getVectorIndex(sample_collections,
                   sample_pools,
                   interval = "Biweek",
                   target_disease = "WNV",
                   pt_estimate = "bc-mle",

                   separate_by = c("agency","species"),
                   wide = FALSE)
    #> Warning: There were 3 warnings in `dplyr::summarise()`.
    #> The first warning was:
    #> ℹ In argument: `InfectionRate = case_when(...)`.
    #> ℹ In group 21: `surv_year = 2015`, `INTERVAL = 16`, `species_display_name = "Cx
    #>   pipiens"`, `agency_code = "Agency_1"`.
    #> Caused by warning in `sqrt()`:
    #> ! NaNs produced
    #> ℹ Run `dplyr::last_dplyr_warnings()` to see the 2 remaining warnings.
    #> # A tibble: 1,417 × 13
    #>     Year Biweek Agency   Species        Count Trap  TrapEvents Abundance Disease
    #>    <dbl>  <dbl> <chr>    <chr>          <int> <chr>      <int>     <dbl> <chr>
    #>  1  2015      1 Agency_1 An freeborni       4 " MM…        186      0.02 <NA>
    #>  2  2015      1 Agency_1 Cs incidens        5 " MM…        186      0.03 <NA>
    #>  3  2015      1 Agency_1 Cs inornata      125 " MM…        186      0.67 <NA>
    #>  4  2015      1 Agency_1 Cx pipiens        41 " MM…        186      0.22 <NA>
    #>  5  2015      1 Agency_1 Cx stigmatoso…     2 " MM…        186      0.01 <NA>
    #>  6  2015      1 Agency_1 Cx tarsalis        4 " MM…        186      0.02 <NA>
    #>  7  2015      2 Agency_1 Cs incidens       10 " MM…        137      0.07 <NA>
    #>  8  2015      2 Agency_1 Cs inornata      147 " MM…        137      1.07 <NA>
    #>  9  2015      2 Agency_1 Cx pipiens        12 " MM…        137      0.09 <NA>
    #> 10  2015      2 Agency_1 Cx stigmatoso…     1 " MM…        137      0.01 <NA>
    #> # ℹ 1,407 more rows
    #> # ℹ 4 more variables: InfectionRate <dbl>, LowerCI <dbl>, UpperCI <dbl>,
    #> #   VectorIndex <dbl>
    sample_collections%>%filter(species_display_name=="Cx tarsalis", trap_acronym=="CO2")
    #> # A tibble: 342 × 14
    #> # Groups:   surv_year [7]
    #>    agency_code collection_id collection_date surv_year species_display_name
    #>    <chr>               <int> <date>              <dbl> <chr>
    #>  1 Agency_1          1392822 2015-04-26           2015 Cx tarsalis
    #>  2 Agency_2          1411490 2015-05-17           2015 Cx tarsalis
    #>  3 Agency_1          1412519 2015-05-22           2015 Cx tarsalis
    #>  4 Agency_1          1415729 2015-05-25           2015 Cx tarsalis
    #>  5 Agency_1          1399581 2015-05-04           2015 Cx tarsalis
    #>  6 Agency_2          1413728 2015-05-22           2015 Cx tarsalis
    #>  7 Agency_1          1408922 2015-05-15           2015 Cx tarsalis
    #>  8 Agency_1          1400736 2015-05-08           2015 Cx tarsalis
    #>  9 Agency_1          1402308 2015-05-11           2015 Cx tarsalis
    #> 10 Agency_1          1412359 2015-05-22           2015 Cx tarsalis
    #> # ℹ 332 more rows
    #> # ℹ 9 more variables: sex_type <chr>, trap_acronym <chr>,
    #> #   trap_problem_bit <lgl>, num_trap <int>, trap_nights <int>, num_count <int>,
    #> #   site_code <dbl>, collection_longitude <dbl>, collection_latitude <dbl>

## Tables

getPoolsComparisionTable()

Description

`getPoolsComparisionTable()` produces a frequency table for positive and negative pools counts by year and species. The more years present in the data, the larger the table.

Usage

`getPoolsComparisionTable(pools,target_disease, species_separate=F)`

Arguments

- pools: Pools data retrieved from `getPools(...)`
- 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 calculation

    getPoolsComparisionTable(
      sample_pools,
      interval = "Week",
      target_disease = "WNV"
    )
    #> # A tibble: 169 × 6
    #> # Groups:   Year, Week [169]
    #>     Year  Week Negative Confirmed Total `Percent Positive`
    #>    <dbl> <dbl>    <int>     <int> <int>              <dbl>
    #>  1  2015    18        3         0     3                  0
    #>  2  2015    19        1         0     1                  0
    #>  3  2015    20        3         0     3                  0
    #>  4  2015    21        9         0     9                  0
    #>  5  2015    22        9         0     9                  0
    #>  6  2015    23        5         0     5                  0
    #>  7  2015    24        6         0     6                  0
    #>  8  2015    25        8         0     8                  0
    #>  9  2015    26        5         0     5                  0
    #> 10  2015    27        9         1    10                 10
    #> # ℹ 159 more rows

### Styling Dataframes with ‘kable’

Professional looking tables can be produced using the ‘kable’ and ‘kableExtra’ packages.

    library(kableExtra)
    #>
    #> Attaching package: 'kableExtra'
    #> The following object is masked from 'package:dplyr':
    #>
    #>     group_rows

    AbAnOutput = getAbundance(
      sample_collections,
      interval = "Biweek",

      species = c("Cx tarsalis", "Cx pipiens"),
      trap = "CO2",
      separate_by = "species")

    head(AbAnOutput)
    #>               Agency Year Biweek     Species Count TrapEvents Trap Abundance
    #> 1           Agency_1 2021      4  Cx pipiens    10          3  CO2      3.33
    #> 2           Agency_1 2021      7  Cx pipiens     4          3  CO2      1.33
    #> 3 Agency_1, Agency_2 2021      8  Cx pipiens    10         10  CO2      1.00
    #> 4           Agency_2 2021      8 Cx tarsalis    13         10  CO2      1.30
    #> 5           Agency_1 2021     10  Cx pipiens     9          5  CO2      1.80
    #> 6           Agency_1 2021     11  Cx pipiens     5         13  CO2      0.38

    #kable table where column names, font_size, style and much more can be customized

    AbAnOutput %>%
      kbl() %>%
      kable_styling(
        bootstrap_options = "striped",
        font_size = 14,
        latex_options = "scale_down"
      ) %>%
      footnote(general = "Table X: Combined biweekly Abundance Calculation for Cx. tarsalis, pipiens in CO2 traps", general_title = "")

Agency | Year | Biweek | Species | Count | TrapEvents | Trap | Abundance
--- | --- | --- | --- | --- | --- | --- | ---
Agency_1 | 2021 | 4 | Cx pipiens | 10 | 3 | CO2 | 3.33
Agency_1 | 2021 | 7 | Cx pipiens | 4 | 3 | CO2 | 1.33
Agency_1, Agency_2 | 2021 | 8 | Cx pipiens | 10 | 10 | CO2 | 1.00
Agency_2 | 2021 | 8 | Cx tarsalis | 13 | 10 | CO2 | 1.30
Agency_1 | 2021 | 10 | Cx pipiens | 9 | 5 | CO2 | 1.80
Agency_1 | 2021 | 11 | Cx pipiens | 5 | 13 | CO2 | 0.38
Agency_1, Agency_2 | 2021 | 11 | Cx tarsalis | 12 | 13 | CO2 | 0.92
Agency_1 | 2021 | 12 | Cx pipiens | 45 | 10 | CO2 | 4.50
Agency_1, Agency_2 | 2021 | 12 | Cx tarsalis | 429 | 10 | CO2 | 42.90
Agency_1, Agency_2 | 2021 | 13 | Cx pipiens | 338 | 12 | CO2 | 28.17
Agency_2 | 2021 | 14 | Cx pipiens | 40 | 9 | CO2 | 4.44
Agency_1, Agency_2 | 2021 | 14 | Cx tarsalis | 39 | 9 | CO2 | 4.33
Agency_1 | 2021 | 15 | Cx pipiens | 23 | 10 | CO2 | 2.30
Agency_1, Agency_2 | 2021 | 15 | Cx tarsalis | 3114 | 10 | CO2 | 311.40
Agency_1, Agency_2 | 2021 | 16 | Cx pipiens | 71 | 12 | CO2 | 5.92
Agency_1, Agency_2 | 2021 | 16 | Cx tarsalis | 2194 | 12 | CO2 | 182.83
Agency_1 | 2021 | 17 | Cx pipiens | 18 | 8 | CO2 | 2.25
Agency_1, Agency_2 | 2021 | 17 | Cx tarsalis | 5 | 8 | CO2 | 0.62
Agency_1, Agency_2 | 2021 | 18 | Cx tarsalis | 49 | 6 | CO2 | 8.17
Agency_1, Agency_2 | 2021 | 19 | Cx tarsalis | 35 | 10 | CO2 | 3.50
Agency_1, Agency_2 | 2021 | 20 | Cx tarsalis | 39 | 10 | CO2 | 3.90
Agency_1 | 2021 | 21 | Cx pipiens | 1 | 6 | CO2 | 0.17
Agency_1 | 2021 | 21 | Cx tarsalis | 15 | 6 | CO2 | 2.50
Agency_2 | 2020 | 9 | Cx tarsalis | 56 | 4 | CO2 | 14.00
Agency_2 | 2020 | 10 | Cx pipiens | 1 | 6 | CO2 | 0.17
Agency_2 | 2020 | 10 | Cx tarsalis | 23 | 6 | CO2 | 3.83
Agency_1, Agency_2 | 2020 | 11 | Cx pipiens | 24 | 15 | CO2 | 1.60
Agency_1, Agency_2 | 2020 | 11 | Cx tarsalis | 180 | 15 | CO2 | 12.00
Agency_1 | 2020 | 12 | Cx pipiens | 5 | 10 | CO2 | 0.50
Agency_1, Agency_2 | 2020 | 12 | Cx tarsalis | 246 | 10 | CO2 | 24.60
Agency_1, Agency_2 | 2020 | 13 | Cx pipiens | 93 | 14 | CO2 | 6.64
Agency_1, Agency_2 | 2020 | 13 | Cx tarsalis | 115 | 14 | CO2 | 8.21
Agency_1, Agency_2 | 2020 | 14 | Cx pipiens | 287 | 12 | CO2 | 23.92
Agency_1, Agency_2 | 2020 | 14 | Cx tarsalis | 2297 | 12 | CO2 | 191.42
Agency_1 | 2020 | 15 | Cx pipiens | 29 | 8 | CO2 | 3.62
Agency_1 | 2020 | 15 | Cx tarsalis | 9 | 8 | CO2 | 1.12
Agency_1, Agency_2 | 2020 | 16 | Cx pipiens | 87 | 8 | CO2 | 10.88
Agency_2 | 2020 | 16 | Cx tarsalis | 258 | 8 | CO2 | 32.25
Agency_1, Agency_2 | 2020 | 17 | Cx pipiens | 13 | 10 | CO2 | 1.30
Agency_1, Agency_2 | 2020 | 17 | Cx tarsalis | 1657 | 10 | CO2 | 165.70
Agency_1, Agency_2 | 2020 | 18 | Cx tarsalis | 79 | 7 | CO2 | 11.29
Agency_1 | 2020 | 19 | Cx pipiens | 44 | 13 | CO2 | 3.38
Agency_1, Agency_2 | 2020 | 19 | Cx tarsalis | 143 | 13 | CO2 | 11.00
Agency_1 | 2020 | 20 | Cx tarsalis | 43 | 12 | CO2 | 3.58
Agency_1 | 2020 | 21 | Cx pipiens | 31 | 13 | CO2 | 2.38
Agency_1, Agency_2 | 2020 | 21 | Cx tarsalis | 30 | 13 | CO2 | 2.31
Agency_1 | 2020 | 22 | Cx pipiens | 2 | 11 | CO2 | 0.18
Agency_1, Agency_2 | 2020 | 22 | Cx tarsalis | 10 | 11 | CO2 | 0.91
Agency_1 | 2020 | 23 | Cx pipiens | 8 | 8 | CO2 | 1.00
Agency_1 | 2020 | 23 | Cx tarsalis | 1 | 8 | CO2 | 0.12
Agency_1 | 2020 | 24 | Cx pipiens | 3 | 4 | CO2 | 0.75
Agency_1 | 2019 | 4 | Cx pipiens | 3 | 1 | CO2 | 3.00
Agency_1 | 2019 | 9 | Cx pipiens | 15 | 9 | CO2 | 1.67
Agency_1 | 2019 | 9 | Cx tarsalis | 3 | 9 | CO2 | 0.33
Agency_1 | 2019 | 10 | Cx pipiens | 8 | 7 | CO2 | 1.14
Agency_1 | 2019 | 10 | Cx tarsalis | 14 | 7 | CO2 | 2.00
Agency_1, Agency_2 | 2019 | 11 | Cx pipiens | 25 | 16 | CO2 | 1.56
Agency_1, Agency_2 | 2019 | 11 | Cx tarsalis | 539 | 16 | CO2 | 33.69
Agency_1, Agency_2 | 2019 | 12 | Cx pipiens | 51 | 4 | CO2 | 12.75
Agency_1 | 2019 | 13 | Cx pipiens | 36 | 13 | CO2 | 2.77
Agency_1, Agency_2 | 2019 | 13 | Cx tarsalis | 845 | 13 | CO2 | 65.00
Agency_2 | 2019 | 14 | Cx pipiens | 14 | 6 | CO2 | 2.33
Agency_2 | 2019 | 14 | Cx tarsalis | 252 | 6 | CO2 | 42.00
Agency_1, Agency_2 | 2019 | 15 | Cx pipiens | 160 | 16 | CO2 | 10.00
Agency_1, Agency_2 | 2019 | 15 | Cx tarsalis | 4079 | 16 | CO2 | 254.94
Agency_1, Agency_2 | 2019 | 16 | Cx pipiens | 14 | 14 | CO2 | 1.00
Agency_1, Agency_2 | 2019 | 16 | Cx tarsalis | 54 | 14 | CO2 | 3.86
Agency_1 | 2019 | 17 | Cx pipiens | 3 | 7 | CO2 | 0.43
Agency_1, Agency_2 | 2019 | 17 | Cx tarsalis | 74 | 7 | CO2 | 10.57
Agency_1 | 2019 | 18 | Cx pipiens | 175 | 6 | CO2 | 29.17
Agency_1 | 2019 | 18 | Cx tarsalis | 87 | 6 | CO2 | 14.50
Agency_1, Agency_2 | 2019 | 19 | Cx pipiens | 42 | 9 | CO2 | 4.67
Agency_1 | 2019 | 19 | Cx tarsalis | 12 | 9 | CO2 | 1.33
Agency_1 | 2019 | 20 | Cx pipiens | 134 | 12 | CO2 | 11.17
Agency_1 | 2019 | 20 | Cx tarsalis | 80 | 12 | CO2 | 6.67
Agency_2 | 2019 | 21 | Cx tarsalis | 37 | 9 | CO2 | 4.11
Agency_1 | 2018 | 10 | Cx pipiens | 8 | 16 | CO2 | 0.50
Agency_1, Agency_2 | 2018 | 10 | Cx tarsalis | 296 | 16 | CO2 | 18.50
Agency_1 | 2018 | 11 | Cx pipiens | 80 | 16 | CO2 | 5.00
Agency_2 | 2018 | 11 | Cx tarsalis | 16 | 16 | CO2 | 1.00
Agency_1 | 2018 | 12 | Cx pipiens | 27 | 16 | CO2 | 1.69
Agency_1, Agency_2 | 2018 | 12 | Cx tarsalis | 63 | 16 | CO2 | 3.94
Agency_1, Agency_2 | 2018 | 13 | Cx pipiens | 132 | 13 | CO2 | 10.15
Agency_1, Agency_2 | 2018 | 13 | Cx tarsalis | 3884 | 13 | CO2 | 298.77
Agency_1, Agency_2 | 2018 | 14 | Cx pipiens | 34 | 9 | CO2 | 3.78
Agency_1, Agency_2 | 2018 | 14 | Cx tarsalis | 452 | 9 | CO2 | 50.22
Agency_1, Agency_2 | 2018 | 15 | Cx pipiens | 105 | 11 | CO2 | 9.55
Agency_1, Agency_2 | 2018 | 15 | Cx tarsalis | 42 | 11 | CO2 | 3.82
Agency_1, Agency_2 | 2018 | 16 | Cx pipiens | 782 | 14 | CO2 | 55.86
Agency_1, Agency_2 | 2018 | 16 | Cx tarsalis | 829 | 14 | CO2 | 59.21
Agency_1 | 2018 | 17 | Cx pipiens | 6 | 13 | CO2 | 0.46
Agency_1 | 2018 | 17 | Cx tarsalis | 35 | 13 | CO2 | 2.69
Agency_1, Agency_2 | 2018 | 18 | Cx pipiens | 200 | 13 | CO2 | 15.38
Agency_1 | 2018 | 18 | Cx tarsalis | 11 | 13 | CO2 | 0.85
Agency_1, Agency_2 | 2018 | 19 | Cx pipiens | 125 | 10 | CO2 | 12.50
Agency_2 | 2018 | 20 | Cx pipiens | 31 | 10 | CO2 | 3.10
Agency_1, Agency_2 | 2018 | 20 | Cx tarsalis | 16 | 10 | CO2 | 1.60
Agency_1, Agency_2 | 2018 | 21 | Cx tarsalis | 11 | 9 | CO2 | 1.22
Agency_1 | 2017 | 8 | Cx pipiens | 10 | 4 | CO2 | 2.50
Agency_1 | 2017 | 9 | Cx pipiens | 11 | 8 | CO2 | 1.38
Agency_1 | 2017 | 9 | Cx tarsalis | 7 | 8 | CO2 | 0.88
Agency_1, Agency_2 | 2017 | 10 | Cx pipiens | 11 | 16 | CO2 | 0.69
Agency_1, Agency_2 | 2017 | 10 | Cx tarsalis | 138 | 16 | CO2 | 8.62
Agency_1 | 2017 | 11 | Cx pipiens | 33 | 13 | CO2 | 2.54
Agency_1, Agency_2 | 2017 | 11 | Cx tarsalis | 318 | 13 | CO2 | 24.46
Agency_1, Agency_2 | 2017 | 12 | Cx pipiens | 43 | 17 | CO2 | 2.53
Agency_1 | 2017 | 12 | Cx tarsalis | 22 | 17 | CO2 | 1.29
Agency_1, Agency_2 | 2017 | 13 | Cx pipiens | 135 | 19 | CO2 | 7.11
Agency_2 | 2017 | 13 | Cx tarsalis | 74 | 19 | CO2 | 3.89
Agency_1, Agency_2 | 2017 | 14 | Cx pipiens | 86 | 23 | CO2 | 3.74
Agency_1, Agency_2 | 2017 | 14 | Cx tarsalis | 324 | 23 | CO2 | 14.09
Agency_1, Agency_2 | 2017 | 15 | Cx pipiens | 230 | 10 | CO2 | 23.00
Agency_2 | 2017 | 15 | Cx tarsalis | 439 | 10 | CO2 | 43.90
Agency_1, Agency_2 | 2017 | 16 | Cx pipiens | 295 | 13 | CO2 | 22.69
Agency_2 | 2017 | 16 | Cx tarsalis | 2279 | 13 | CO2 | 175.31
Agency_1, Agency_2 | 2017 | 17 | Cx pipiens | 286 | 22 | CO2 | 13.00
Agency_1, Agency_2 | 2017 | 17 | Cx tarsalis | 4249 | 22 | CO2 | 193.14
Agency_1, Agency_2 | 2017 | 18 | Cx pipiens | 31 | 17 | CO2 | 1.82
Agency_1, Agency_2 | 2017 | 18 | Cx tarsalis | 431 | 17 | CO2 | 25.35
Agency_1, Agency_2 | 2017 | 19 | Cx pipiens | 138 | 10 | CO2 | 13.80
Agency_2 | 2017 | 19 | Cx tarsalis | 6 | 10 | CO2 | 0.60
Agency_1, Agency_2 | 2017 | 20 | Cx pipiens | 42 | 22 | CO2 | 1.91
Agency_1 | 2017 | 20 | Cx tarsalis | 7 | 22 | CO2 | 0.32
Agency_1, Agency_2 | 2017 | 21 | Cx tarsalis | 138 | 16 | CO2 | 8.62
Agency_1 | 2016 | 8 | Cx tarsalis | 68 | 12 | CO2 | 5.67
Agency_1 | 2016 | 9 | Cx pipiens | 6 | 11 | CO2 | 0.55
Agency_1 | 2016 | 9 | Cx tarsalis | 7 | 11 | CO2 | 0.64
Agency_1 | 2016 | 10 | Cx pipiens | 59 | 9 | CO2 | 6.56
Agency_1, Agency_2 | 2016 | 10 | Cx tarsalis | 264 | 9 | CO2 | 29.33
Agency_2 | 2016 | 11 | Cx pipiens | 8 | 15 | CO2 | 0.53
Agency_1, Agency_2 | 2016 | 11 | Cx tarsalis | 44 | 15 | CO2 | 2.93
Agency_1, Agency_2 | 2016 | 12 | Cx pipiens | 17 | 26 | CO2 | 0.65
Agency_1, Agency_2 | 2016 | 12 | Cx tarsalis | 542 | 26 | CO2 | 20.85
Agency_1, Agency_2 | 2016 | 13 | Cx pipiens | 91 | 21 | CO2 | 4.33
Agency_1, Agency_2 | 2016 | 13 | Cx tarsalis | 1098 | 21 | CO2 | 52.29
Agency_1 | 2016 | 14 | Cx pipiens | 7 | 10 | CO2 | 0.70
Agency_1 | 2016 | 14 | Cx tarsalis | 87 | 10 | CO2 | 8.70
Agency_1, Agency_2 | 2016 | 15 | Cx pipiens | 208 | 18 | CO2 | 11.56
Agency_1, Agency_2 | 2016 | 15 | Cx tarsalis | 1990 | 18 | CO2 | 110.56
Agency_1, Agency_2 | 2016 | 16 | Cx pipiens | 454 | 10 | CO2 | 45.40
Agency_1, Agency_2 | 2016 | 16 | Cx tarsalis | 674 | 10 | CO2 | 67.40
Agency_1, Agency_2 | 2016 | 17 | Cx pipiens | 395 | 18 | CO2 | 21.94
Agency_1, Agency_2 | 2016 | 17 | Cx tarsalis | 712 | 18 | CO2 | 39.56
Agency_1, Agency_2 | 2016 | 18 | Cx pipiens | 78 | 16 | CO2 | 4.88
Agency_1, Agency_2 | 2016 | 18 | Cx tarsalis | 252 | 16 | CO2 | 15.75
Agency_1, Agency_2 | 2016 | 19 | Cx pipiens | 23 | 17 | CO2 | 1.35
Agency_1, Agency_2 | 2016 | 19 | Cx tarsalis | 137 | 17 | CO2 | 8.06
Agency_1, Agency_2 | 2016 | 20 | Cx pipiens | 28 | 16 | CO2 | 1.75
Agency_1, Agency_2 | 2016 | 20 | Cx tarsalis | 10 | 16 | CO2 | 0.62
Agency_2 | 2016 | 21 | Cx pipiens | 1 | 9 | CO2 | 0.11
Agency_1 | 2016 | 21 | Cx tarsalis | 7 | 9 | CO2 | 0.78
Agency_1, Agency_2 | 2015 | 8 | Cx pipiens | 8 | 6 | CO2 | 1.33
Agency_1 | 2015 | 9 | Cx pipiens | 1 | 10 | CO2 | 0.10
Agency_1 | 2015 | 9 | Cx tarsalis | 11 | 10 | CO2 | 1.10
Agency_1, Agency_2 | 2015 | 10 | Cx pipiens | 14 | 27 | CO2 | 0.52
Agency_1, Agency_2 | 2015 | 10 | Cx tarsalis | 598 | 27 | CO2 | 22.15
Agency_1 | 2015 | 11 | Cx pipiens | 38 | 19 | CO2 | 2.00
Agency_1, Agency_2 | 2015 | 11 | Cx tarsalis | 280 | 19 | CO2 | 14.74
Agency_1 | 2015 | 12 | Cx pipiens | 144 | 16 | CO2 | 9.00
Agency_1, Agency_2 | 2015 | 12 | Cx tarsalis | 593 | 16 | CO2 | 37.06
Agency_1, Agency_2 | 2015 | 13 | Cx pipiens | 80 | 17 | CO2 | 4.71
Agency_1, Agency_2 | 2015 | 13 | Cx tarsalis | 325 | 17 | CO2 | 19.12
Agency_1, Agency_2 | 2015 | 14 | Cx pipiens | 204 | 15 | CO2 | 13.60
Agency_1, Agency_2 | 2015 | 14 | Cx tarsalis | 327 | 15 | CO2 | 21.80
Agency_1, Agency_2 | 2015 | 15 | Cx pipiens | 572 | 10 | CO2 | 57.20
Agency_1 | 2015 | 15 | Cx tarsalis | 208 | 10 | CO2 | 20.80
Agency_1, Agency_2 | 2015 | 16 | Cx pipiens | 172 | 18 | CO2 | 9.56
Agency_1, Agency_2 | 2015 | 16 | Cx tarsalis | 633 | 18 | CO2 | 35.17
Agency_1 | 2015 | 17 | Cx pipiens | 126 | 15 | CO2 | 8.40
Agency_1, Agency_2 | 2015 | 17 | Cx tarsalis | 2307 | 15 | CO2 | 153.80
Agency_1, Agency_2 | 2015 | 18 | Cx pipiens | 288 | 20 | CO2 | 14.40
Agency_1, Agency_2 | 2015 | 18 | Cx tarsalis | 1768 | 20 | CO2 | 88.40
Agency_1, Agency_2 | 2015 | 19 | Cx pipiens | 98 | 17 | CO2 | 5.76
Agency_1 | 2015 | 19 | Cx tarsalis | 66 | 17 | CO2 | 3.88
Agency_1, Agency_2 | 2015 | 20 | Cx pipiens | 351 | 22 | CO2 | 15.95
Agency_1 | 2015 | 20 | Cx tarsalis | 218 | 22 | CO2 | 9.91
Agency_1 | 2015 | 21 | Cx pipiens | 45 | 5 | CO2 | 9.00
Table X: Combined biweekly Abundance Calculation for Cx. tarsalis, pipiens in CO2 traps

### Data using ‘datatables’

Interactive html only tables can be produced using the ‘DT’ package. ‘DT’ tables allow for sorting and filtering with in a webpage. These are ideal for viewing data but are not compatible with pdf or word formats.

    library(DT)

    AbAnOutput %>%
      datatable(colnames =  c("Disease Year", "Biweek", "Count", "Species","Trap Type","Trap Events", "Abundance"))

    table(vectorsurvR:::testing_collections$trap_acronym, vectorsurvR:::testing_collections$surv_year) %>%
      kbl(align = "c") %>%
      kable_paper(
        full_width = F,
        html_font = "arial",
        lightable_options = "striped",
      ) %>%
      add_header_above(c("Trap Type", "Years" = 6)) %>%
      footnote(general = "Table 3: Traps deployed by year", general_title = "") %>%
      row_spec(c(3, 9, 10), background = "yellow") %>%
      column_spec(c(4), background = "orange")

Trap Type | Years
--- | ---
| 2019 | 2020 | 2021 | 2022 | 2023 | 2024
BACKPACK | 0 | 0 | 26 | 33 | 11 | 5
BGSENT | 1215 | 90 | 5600 | 7139 | 6898 | 9629
BTLJC | 30 | 33 | 63 | 0 | 0 | 0
CDCAGO | 20 | 0 | 0 | 0 | 0 | 0
CO2 | 12143 | 11622 | 10901 | 9719 | 12364 | 13437
FLANNEL | 3 | 3 | 9 | 14 | 11 | 6
GRVD | 9547 | 10181 | 9221 | 8611 | 9069 | 8820
LCKR | 1434 | 3092 | 3707 | 3693 | 3559 | 3744
NJLT | 3062 | 844 | 0 | 0 | 0 | 0
OTHER | 0 | 0 | 10 | 11 | 37 | 517
OVI | 4 | 0 | 0 | 294 | 0 | 0
WRKR | 0 | 0 | 77 | 0 | 0 | 0
Table 3: Traps deployed by year