# 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] "agency_id"            "county"               "collection_longitude"
    #> [16] "collection_latitude"  "spatial_feature"      "multiple_features"

    #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
    #>   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()
    #> # 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

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                 36
    #> 3 2015-01-02      Cx pipiens                   1
    #> 4 2015-01-02      Cx tarsalis                  3
    #> 5 2015-01-10      An freeborni                 4
    #> 6 2015-01-10      Cs inornata                108

    #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                4.5
    #> 3 2015-01-02      Cx pipiens                 1
    #> 4 2015-01-02      Cx tarsalis                1.5
    #> 5 2015-01-10      An freeborni               4
    #> 6 2015-01-10      Cs inornata               36

### 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, agency_id, county, collection_longitude,
    #>   collection_latitude, spatial_feature, multiple_features,
    #>   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   County                 Species Count TrapEvents Trap
    #> 1   AGENCY 2021      4 County 1          No Collections     0          3  CO2
    #> 2   AGENCY 2021      6 County 1          No Collections     0          3  CO2
    #> 3   AGENCY 2021      7 County 1             Cx tarsalis     2          3  CO2
    #> 4   AGENCY 2021      8 County 1 Cx pipiens, Cx tarsalis    50          7  CO2
    #> 5   AGENCY 2021      9 County 1          No Collections     0          1  CO2
    #> 6   AGENCY 2021     10 County 1 Cx pipiens, Cx tarsalis    79          6  CO2
    #> 7   AGENCY 2021     11 County 1 Cx pipiens, Cx tarsalis    41          9  CO2
    #> 8   AGENCY 2021     12 County 1 Cx pipiens, Cx tarsalis   549         14  CO2
    #> 9   AGENCY 2021     13 County 1             Cx tarsalis  3573          7  CO2
    #> 10  AGENCY 2021     14 County 1 Cx pipiens, Cx tarsalis   900          8  CO2
    #> 11  AGENCY 2021     15 County 1 Cx pipiens, Cx tarsalis    70          6  CO2
    #> 12  AGENCY 2021     16 County 1 Cx pipiens, Cx tarsalis    80         11  CO2
    #> 13  AGENCY 2021     17 County 1 Cx pipiens, Cx tarsalis   371          7  CO2
    #> 14  AGENCY 2021     18 County 1             Cx tarsalis     8          4  CO2
    #> 15  AGENCY 2021     19 County 1             Cx tarsalis    29          6  CO2
    #> 16  AGENCY 2021     20 County 1              Cx pipiens    57          9  CO2
    #> 17  AGENCY 2021     21 County 1 Cx pipiens, Cx tarsalis    14          3  CO2
    #> 18  AGENCY 2021     22 County 1          No Collections     0          1  CO2
    #> 19  AGENCY 2020      9 County 1              Cx pipiens     1          3  CO2
    #> 20  AGENCY 2020     10 County 1              Cx pipiens     4          7  CO2
    #> 21  AGENCY 2020     11 County 1 Cx pipiens, Cx tarsalis    27         11  CO2
    #> 22  AGENCY 2020     12 County 1             Cx tarsalis     1          9  CO2
    #> 23  AGENCY 2020     13 County 1              Cx pipiens    81          5  CO2
    #> 24  AGENCY 2020     14 County 1 Cx pipiens, Cx tarsalis  1731          9  CO2
    #> 25  AGENCY 2020     15 County 1             Cx tarsalis    63          6  CO2
    #> 26  AGENCY 2020     16 County 1 Cx pipiens, Cx tarsalis   274          8  CO2
    #> 27  AGENCY 2020     17 County 1 Cx pipiens, Cx tarsalis    17          6  CO2
    #> 28  AGENCY 2020     18 County 1 Cx pipiens, Cx tarsalis   503          4  CO2
    #> 29  AGENCY 2020     19 County 1 Cx pipiens, Cx tarsalis    73         14  CO2
    #> 30  AGENCY 2020     20 County 1             Cx tarsalis     1          5  CO2
    #> 31  AGENCY 2020     21 County 1              Cx pipiens   145          7  CO2
    #> 32  AGENCY 2020     22 County 1              Cx pipiens    20          7  CO2
    #> 33  AGENCY 2020     23 County 1 Cx pipiens, Cx tarsalis     8          4  CO2
    #> 34  AGENCY 2020     24 County 1          No Collections     0          1  CO2
    #> 35  AGENCY 2019      9 County 1 Cx pipiens, Cx tarsalis   116         10  CO2
    #> 36  AGENCY 2019     10 County 1              Cx pipiens    15          5  CO2
    #> 37  AGENCY 2019     11 County 1 Cx pipiens, Cx tarsalis   597         13  CO2
    #> 38  AGENCY 2019     12 County 1              Cx pipiens     2          4  CO2
    #> 39  AGENCY 2019     13 County 1             Cx tarsalis   596          5  CO2
    #> 40  AGENCY 2019     14 County 1             Cx tarsalis    60          4  CO2
    #> 41  AGENCY 2019     15 County 1 Cx pipiens, Cx tarsalis  4887         10  CO2
    #> 42  AGENCY 2019     16 County 1 Cx pipiens, Cx tarsalis  2192         15  CO2
    #> 43  AGENCY 2019     17 County 1 Cx pipiens, Cx tarsalis  2396          6  CO2
    #> 44  AGENCY 2019     18 County 1 Cx pipiens, Cx tarsalis  6097         11  CO2
    #> 45  AGENCY 2019     19 County 1 Cx pipiens, Cx tarsalis   136          6  CO2
    #> 46  AGENCY 2019     20 County 1          No Collections     0          2  CO2
    #> 47  AGENCY 2019     21 County 1 Cx pipiens, Cx tarsalis   101          8  CO2
    #> 48  AGENCY 2018     10 County 1 Cx pipiens, Cx tarsalis   346          7  CO2
    #> 49  AGENCY 2018     11 County 1 Cx pipiens, Cx tarsalis   213         19  CO2
    #> 50  AGENCY 2018     12 County 1              Cx pipiens     7         10  CO2
    #> 51  AGENCY 2018     13 County 1 Cx pipiens, Cx tarsalis  3024         10  CO2
    #> 52  AGENCY 2018     14 County 1 Cx pipiens, Cx tarsalis   231         10  CO2
    #> 53  AGENCY 2018     15 County 1 Cx pipiens, Cx tarsalis  1046          7  CO2
    #> 54  AGENCY 2018     16 County 1             Cx tarsalis  1649          5  CO2
    #> 55  AGENCY 2018     17 County 1 Cx pipiens, Cx tarsalis   126          8  CO2
    #> 56  AGENCY 2018     18 County 1             Cx tarsalis   258          7  CO2
    #> 57  AGENCY 2018     19 County 1 Cx pipiens, Cx tarsalis   521         10  CO2
    #> 58  AGENCY 2018     20 County 1 Cx pipiens, Cx tarsalis    64         10  CO2
    #> 59  AGENCY 2018     21 County 1 Cx pipiens, Cx tarsalis    35          7  CO2
    #> 60  AGENCY 2017      4 County 1             Cx tarsalis     2          1  CO2
    #> 61  AGENCY 2017      8 County 1          No Collections     0          1  CO2
    #> 62  AGENCY 2017      9 County 1              Cx pipiens     8         11  CO2
    #> 63  AGENCY 2017     10 County 1 Cx pipiens, Cx tarsalis    67         13  CO2
    #> 64  AGENCY 2017     11 County 1 Cx pipiens, Cx tarsalis   852          8  CO2
    #> 65  AGENCY 2017     12 County 1 Cx pipiens, Cx tarsalis   311         11  CO2
    #> 66  AGENCY 2017     13 County 1 Cx pipiens, Cx tarsalis   400          9  CO2
    #> 67  AGENCY 2017     14 County 1 Cx pipiens, Cx tarsalis  1269         10  CO2
    #> 68  AGENCY 2017     15 County 1 Cx pipiens, Cx tarsalis  2020         16  CO2
    #> 69  AGENCY 2017     16 County 1 Cx pipiens, Cx tarsalis   801         10  CO2
    #> 70  AGENCY 2017     17 County 1 Cx pipiens, Cx tarsalis  2507         13  CO2
    #> 71  AGENCY 2017     18 County 1 Cx pipiens, Cx tarsalis  2108         12  CO2
    #> 72  AGENCY 2017     19 County 1 Cx pipiens, Cx tarsalis    52         11  CO2
    #> 73  AGENCY 2017     20 County 1 Cx pipiens, Cx tarsalis   141         11  CO2
    #> 74  AGENCY 2017     21 County 1 Cx pipiens, Cx tarsalis    60         14  CO2
    #> 75  AGENCY 2016      8 County 1 Cx pipiens, Cx tarsalis     3          7  CO2
    #> 76  AGENCY 2016      9 County 1 Cx pipiens, Cx tarsalis    46         13  CO2
    #> 77  AGENCY 2016     10 County 1 Cx pipiens, Cx tarsalis   126          8  CO2
    #> 78  AGENCY 2016     11 County 1 Cx pipiens, Cx tarsalis    19          9  CO2
    #> 79  AGENCY 2016     12 County 1 Cx pipiens, Cx tarsalis   254          7  CO2
    #> 80  AGENCY 2016     13 County 1 Cx pipiens, Cx tarsalis   741         12  CO2
    #> 81  AGENCY 2016     14 County 1 Cx pipiens, Cx tarsalis  2459         13  CO2
    #> 82  AGENCY 2016     15 County 1 Cx pipiens, Cx tarsalis  1704         10  CO2
    #> 83  AGENCY 2016     16 County 1 Cx pipiens, Cx tarsalis  3327         10  CO2
    #> 84  AGENCY 2016     17 County 1 Cx pipiens, Cx tarsalis  2740         15  CO2
    #> 85  AGENCY 2016     18 County 1 Cx pipiens, Cx tarsalis    62         11  CO2
    #> 86  AGENCY 2016     19 County 1 Cx pipiens, Cx tarsalis    29          7  CO2
    #> 87  AGENCY 2016     20 County 1 Cx pipiens, Cx tarsalis    20         16  CO2
    #> 88  AGENCY 2016     21 County 1 Cx pipiens, Cx tarsalis   111          6  CO2
    #> 89  AGENCY 2015      8 County 1              Cx pipiens     3          4  CO2
    #> 90  AGENCY 2015      9 County 1 Cx pipiens, Cx tarsalis    59         12  CO2
    #> 91  AGENCY 2015     10 County 1 Cx pipiens, Cx tarsalis   164         15  CO2
    #> 92  AGENCY 2015     11 County 1 Cx pipiens, Cx tarsalis   140          5  CO2
    #> 93  AGENCY 2015     12 County 1 Cx pipiens, Cx tarsalis   356         11  CO2
    #> 94  AGENCY 2015     13 County 1 Cx pipiens, Cx tarsalis   535         17  CO2
    #> 95  AGENCY 2015     14 County 1 Cx pipiens, Cx tarsalis   664         10  CO2
    #> 96  AGENCY 2015     15 County 1 Cx pipiens, Cx tarsalis  1427         10  CO2
    #> 97  AGENCY 2015     16 County 1 Cx pipiens, Cx tarsalis  4855         14  CO2
    #> 98  AGENCY 2015     17 County 1 Cx pipiens, Cx tarsalis   118          8  CO2
    #> 99  AGENCY 2015     18 County 1              Cx pipiens     9          6  CO2
    #> 100 AGENCY 2015     19 County 1 Cx pipiens, Cx tarsalis   223         15  CO2
    #> 101 AGENCY 2015     20 County 1 Cx pipiens, Cx tarsalis   107         12  CO2
    #> 102 AGENCY 2015     21 County 1 Cx pipiens, Cx tarsalis    76          4  CO2
    #> 103 AGENCY 2015     23 County 1          No Collections     0          2  CO2
    #>     Abundance
    #> 1      0.0000
    #> 2      0.0000
    #> 3      0.6667
    #> 4      7.1429
    #> 5      0.0000
    #> 6     13.1667
    #> 7      4.5556
    #> 8     39.2143
    #> 9    510.4286
    #> 10   112.5000
    #> 11    11.6667
    #> 12     7.2727
    #> 13    53.0000
    #> 14     2.0000
    #> 15     4.8333
    #> 16     6.3333
    #> 17     4.6667
    #> 18     0.0000
    #> 19     0.3333
    #> 20     0.5714
    #> 21     2.4545
    #> 22     0.1111
    #> 23    16.2000
    #> 24   192.3333
    #> 25    10.5000
    #> 26    34.2500
    #> 27     2.8333
    #> 28   125.7500
    #> 29     5.2143
    #> 30     0.2000
    #> 31    20.7143
    #> 32     2.8571
    #> 33     2.0000
    #> 34     0.0000
    #> 35    11.6000
    #> 36     3.0000
    #> 37    45.9231
    #> 38     0.5000
    #> 39   119.2000
    #> 40    15.0000
    #> 41   488.7000
    #> 42   146.1333
    #> 43   399.3333
    #> 44   554.2727
    #> 45    22.6667
    #> 46     0.0000
    #> 47    12.6250
    #> 48    49.4286
    #> 49    11.2105
    #> 50     0.7000
    #> 51   302.4000
    #> 52    23.1000
    #> 53   149.4286
    #> 54   329.8000
    #> 55    15.7500
    #> 56    36.8571
    #> 57    52.1000
    #> 58     6.4000
    #> 59     5.0000
    #> 60     2.0000
    #> 61     0.0000
    #> 62     0.7273
    #> 63     5.1538
    #> 64   106.5000
    #> 65    28.2727
    #> 66    44.4444
    #> 67   126.9000
    #> 68   126.2500
    #> 69    80.1000
    #> 70   192.8462
    #> 71   175.6667
    #> 72     4.7273
    #> 73    12.8182
    #> 74     4.2857
    #> 75     0.4286
    #> 76     3.5385
    #> 77    15.7500
    #> 78     2.1111
    #> 79    36.2857
    #> 80    61.7500
    #> 81   189.1538
    #> 82   170.4000
    #> 83   332.7000
    #> 84   182.6667
    #> 85     5.6364
    #> 86     4.1429
    #> 87     1.2500
    #> 88    18.5000
    #> 89     0.7500
    #> 90     4.9167
    #> 91    10.9333
    #> 92    28.0000
    #> 93    32.3636
    #> 94    31.4706
    #> 95    66.4000
    #> 96   142.7000
    #> 97   346.7857
    #> 98    14.7500
    #> 99     1.5000
    #> 100   14.8667
    #> 101    8.9167
    #> 102   19.0000
    #> 103    0.0000

### 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.
    #>    Agency Year Biweek   County     Species Count TrapEvents Trap Abundance
    #> 1  AGENCY 2020      9 County 1 Cx tarsalis     0          3  CO2    0.0000
    #> 2  AGENCY 2020      9 County 1  Cx pipiens     1          3  CO2    0.3333
    #> 3  AGENCY 2020     10 County 1 Cx tarsalis     0          7  CO2    0.0000
    #> 4  AGENCY 2020     10 County 1  Cx pipiens     4          7  CO2    0.5714
    #> 5  AGENCY 2020     11 County 1 Cx tarsalis     9         11  CO2    0.8182
    #> 6  AGENCY 2020     11 County 1  Cx pipiens    18         11  CO2    1.6364
    #> 7  AGENCY 2020     12 County 1 Cx tarsalis     1          9  CO2    0.1111
    #> 8  AGENCY 2020     12 County 1  Cx pipiens     0          9  CO2    0.0000
    #> 9  AGENCY 2020     13 County 1 Cx tarsalis     0          5  CO2    0.0000
    #> 10 AGENCY 2020     13 County 1  Cx pipiens    81          5  CO2   16.2000
    #> 11 AGENCY 2020     14 County 1 Cx tarsalis  1717          9  CO2  190.7778
    #> 12 AGENCY 2020     14 County 1  Cx pipiens    14          9  CO2    1.5556
    #> 13 AGENCY 2020     15 County 1 Cx tarsalis    63          6  CO2   10.5000
    #> 14 AGENCY 2020     15 County 1  Cx pipiens     0          6  CO2    0.0000
    #> 15 AGENCY 2020     16 County 1 Cx tarsalis   207          8  CO2   25.8750
    #> 16 AGENCY 2020     16 County 1  Cx pipiens    67          8  CO2    8.3750
    #> 17 AGENCY 2020     17 County 1 Cx tarsalis    15          6  CO2    2.5000
    #> 18 AGENCY 2020     17 County 1  Cx pipiens     2          6  CO2    0.3333
    #> 19 AGENCY 2020     18 County 1 Cx tarsalis   499          4  CO2  124.7500
    #> 20 AGENCY 2020     18 County 1  Cx pipiens     4          4  CO2    1.0000
    #> 21 AGENCY 2020     19 County 1 Cx tarsalis    58         14  CO2    4.1429
    #> 22 AGENCY 2020     19 County 1  Cx pipiens    15         14  CO2    1.0714
    #> 23 AGENCY 2020     20 County 1 Cx tarsalis     1          5  CO2    0.2000
    #> 24 AGENCY 2020     20 County 1  Cx pipiens     0          5  CO2    0.0000
    #> 25 AGENCY 2020     21 County 1 Cx tarsalis     0          7  CO2    0.0000
    #> 26 AGENCY 2020     21 County 1  Cx pipiens   145          7  CO2   20.7143
    #> 27 AGENCY 2020     22 County 1 Cx tarsalis     0          7  CO2    0.0000
    #> 28 AGENCY 2020     22 County 1  Cx pipiens    20          7  CO2    2.8571
    #> 29 AGENCY 2020     23 County 1 Cx tarsalis     5          4  CO2    1.2500
    #> 30 AGENCY 2020     23 County 1  Cx pipiens     3          4  CO2    0.7500
    #> 31 AGENCY 2020     24 County 1 Cx tarsalis     0          1  CO2    0.0000
    #> 32 AGENCY 2020     24 County 1  Cx pipiens     0          1  CO2    0.0000
    #>    FiveYearAvg           YearsInAverage   Delta
    #> 1     3.866350      2015,2016,2017,2019 -100.00
    #> 2     1.329275      2015,2016,2017,2019  -74.93
    #> 3    14.424880 2015,2016,2017,2018,2019 -100.00
    #> 4     2.428300 2015,2016,2017,2018,2019  -76.47
    #> 5    23.029360 2015,2016,2017,2018,2019  -96.45
    #> 6    15.719580 2015,2016,2017,2018,2019  -89.59
    #> 7     9.337660 2015,2016,2017,2018,2019  -98.81
    #> 8    10.286760 2015,2016,2017,2018,2019 -100.00
    #> 9    99.279740 2015,2016,2017,2018,2019 -100.00
    #> 10   12.573280 2015,2016,2017,2018,2019   28.84
    #> 11   47.780000 2015,2016,2017,2018,2019  299.28
    #> 12   36.330760 2015,2016,2017,2018,2019  -95.72
    #> 13  189.793920 2015,2016,2017,2018,2019  -94.47
    #> 14   25.701780 2015,2016,2017,2018,2019 -100.00
    #> 15  162.067620 2015,2016,2017,2018,2019  -84.03
    #> 16   85.036200 2015,2016,2017,2018,2019  -90.15
    #> 17   86.616540 2015,2016,2017,2018,2019  -97.11
    #> 18   74.452700 2015,2016,2017,2018,2019  -99.55
    #> 19  116.765360 2015,2016,2017,2018,2019    6.84
    #> 20   38.021200 2015,2016,2017,2018,2019  -97.37
    #> 21   10.444840 2015,2016,2017,2018,2019  -60.34
    #> 22    9.255860 2015,2016,2017,2018,2019  -88.42
    #> 23    2.872200 2015,2016,2017,2018,2019  -93.04
    #> 24    3.004780 2015,2016,2017,2018,2019 -100.00
    #> 25    3.391660 2015,2016,2017,2018,2019 -100.00
    #> 26    8.490480 2015,2016,2017,2018,2019  143.97
    #> 27          NA                     <NA>      NA
    #> 28          NA                     <NA>      NA
    #> 29    0.000000                     2015     Inf
    #> 30    0.000000                     2015     Inf
    #> 31          NA                     <NA>      NA
    #> 32          NA                     <NA>      NA

### 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.

    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")
    #> Warning: There were 3 warnings in `dplyr::summarise()`.
    #> The first warning was:
    #> ℹ In argument: `InfectionRate = case_when(...)`.
    #> ℹ In group 20: `surv_year = 2017`, `INTERVAL = 32`, `species_display_name = "Cx
    #>   tarsalis"`.
    #> Caused by warning in `sqrt()`:
    #> ! NaNs produced
    #> ℹ Run `dplyr::last_dplyr_warnings()` to see the 2 remaining warnings.
    #> # A tibble: 196 × 9
    #> # Groups:   Year, Week [113]
    #>     Year  Week Agency Species     Trap  Disease InfectionRate LowerCI UpperCI
    #>    <dbl> <dbl> <chr>  <chr>       <chr> <chr>           <dbl>   <dbl>   <dbl>
    #>  1  2017    22 AGENCY Cx pipiens  CO2   WNV                 0       0       0
    #>  2  2017    22 AGENCY Cx tarsalis CO2   WNV                 0       0       0
    #>  3  2017    23 AGENCY Cx pipiens  CO2   WNV                 0       0       0
    #>  4  2017    23 AGENCY Cx tarsalis CO2   WNV                 0       0       0
    #>  5  2017    24 AGENCY Cx pipiens  CO2   WNV                 0       0       0
    #>  6  2017    25 AGENCY Cx pipiens  CO2   WNV                 0       0       0
    #>  7  2017    25 AGENCY Cx tarsalis CO2   WNV                 0       0       0
    #>  8  2017    26 AGENCY Cx pipiens  CO2   WNV                 0       0       0
    #>  9  2017    26 AGENCY Cx tarsalis CO2   WNV                 0       0       0
    #> 10  2017    27 AGENCY Cx tarsalis CO2   WNV                 0       0       0
    #> # ℹ 186 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

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

                   separate_by = c("agency","species"))
    #> [1] "Years in Pools and Collections data do not match. Years much match for function to operate."
    sample_collections%>%filter(species_display_name=="Cx tarsalis", trap_acronym=="CO2")
    #> # A tibble: 222 × 18
    #>    agency_code collection_id collection_date surv_year species_display_name
    #>    <chr>               <int> <date>              <dbl> <chr>
    #>  1 AGENCY            1392963 2015-04-26           2015 Cx tarsalis
    #>  2 AGENCY            1395391 2015-04-26           2015 Cx tarsalis
    #>  3 AGENCY            1392822 2015-04-26           2015 Cx tarsalis
    #>  4 AGENCY            1398260 2015-05-03           2015 Cx tarsalis
    #>  5 AGENCY            1409186 2015-05-15           2015 Cx tarsalis
    #>  6 AGENCY            1400680 2015-05-08           2015 Cx tarsalis
    #>  7 AGENCY            1411484 2015-05-17           2015 Cx tarsalis
    #>  8 AGENCY            1402328 2015-05-11           2015 Cx tarsalis
    #>  9 AGENCY            1425396 2015-06-07           2015 Cx tarsalis
    #> 10 AGENCY            1419375 2015-06-01           2015 Cx tarsalis
    #> # ℹ 212 more rows
    #> # ℹ 13 more variables: sex_type <chr>, trap_acronym <chr>,
    #> #   trap_problem_bit <lgl>, num_trap <int>, trap_nights <int>, num_count <int>,
    #> #   site_code <dbl>, agency_id <dbl>, county <chr>, collection_longitude <dbl>,
    #> #   collection_latitude <dbl>, spatial_feature <chr>, multiple_features <lgl>

## 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: 119 × 6
    #> # Groups:   Year, Week [119]
    #>     Year  Week Negative Confirmed Total `Percent Positive`
    #>    <dbl> <dbl>    <int>     <int> <int>              <dbl>
    #>  1  2017    20        2         0     2                0
    #>  2  2017    21        3         0     3                0
    #>  3  2017    22       10         0    10                0
    #>  4  2017    23        7         0     7                0
    #>  5  2017    24       10         0    10                0
    #>  6  2017    25        8         0     8                0
    #>  7  2017    26        4         0     4                0
    #>  8  2017    27        7         1     8               12.5
    #>  9  2017    28       10         0    10                0
    #> 10  2017    29        8         0     8                0
    #> # ℹ 109 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   County     Species Count TrapEvents Trap Abundance
    #> 1 AGENCY 2021      4 County 1 Cx tarsalis     0          3  CO2    0.0000
    #> 2 AGENCY 2021      4 County 1  Cx pipiens     0          3  CO2    0.0000
    #> 3 AGENCY 2021      6 County 1 Cx tarsalis     0          3  CO2    0.0000
    #> 4 AGENCY 2021      6 County 1  Cx pipiens     0          3  CO2    0.0000
    #> 5 AGENCY 2021      7 County 1 Cx tarsalis     2          3  CO2    0.6667
    #> 6 AGENCY 2021      7 County 1  Cx pipiens     0          3  CO2    0.0000

    #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 | County | Species | Count | TrapEvents | Trap | Abundance
--- | --- | --- | --- | --- | --- | --- | --- | ---
AGENCY | 2021 | 4 | County 1 | Cx tarsalis | 0 | 3 | CO2 | 0.0000
AGENCY | 2021 | 4 | County 1 | Cx pipiens | 0 | 3 | CO2 | 0.0000
AGENCY | 2021 | 6 | County 1 | Cx tarsalis | 0 | 3 | CO2 | 0.0000
AGENCY | 2021 | 6 | County 1 | Cx pipiens | 0 | 3 | CO2 | 0.0000
AGENCY | 2021 | 7 | County 1 | Cx tarsalis | 2 | 3 | CO2 | 0.6667
AGENCY | 2021 | 7 | County 1 | Cx pipiens | 0 | 3 | CO2 | 0.0000
AGENCY | 2021 | 8 | County 1 | Cx tarsalis | 31 | 7 | CO2 | 4.4286
AGENCY | 2021 | 8 | County 1 | Cx pipiens | 19 | 7 | CO2 | 2.7143
AGENCY | 2021 | 9 | County 1 | Cx tarsalis | 0 | 1 | CO2 | 0.0000
AGENCY | 2021 | 9 | County 1 | Cx pipiens | 0 | 1 | CO2 | 0.0000
AGENCY | 2021 | 10 | County 1 | Cx tarsalis | 51 | 6 | CO2 | 8.5000
AGENCY | 2021 | 10 | County 1 | Cx pipiens | 28 | 6 | CO2 | 4.6667
AGENCY | 2021 | 11 | County 1 | Cx tarsalis | 23 | 9 | CO2 | 2.5556
AGENCY | 2021 | 11 | County 1 | Cx pipiens | 18 | 9 | CO2 | 2.0000
AGENCY | 2021 | 12 | County 1 | Cx tarsalis | 342 | 14 | CO2 | 24.4286
AGENCY | 2021 | 12 | County 1 | Cx pipiens | 207 | 14 | CO2 | 14.7857
AGENCY | 2021 | 13 | County 1 | Cx tarsalis | 3573 | 7 | CO2 | 510.4286
AGENCY | 2021 | 13 | County 1 | Cx pipiens | 0 | 7 | CO2 | 0.0000
AGENCY | 2021 | 14 | County 1 | Cx tarsalis | 820 | 8 | CO2 | 102.5000
AGENCY | 2021 | 14 | County 1 | Cx pipiens | 80 | 8 | CO2 | 10.0000
AGENCY | 2021 | 15 | County 1 | Cx tarsalis | 69 | 6 | CO2 | 11.5000
AGENCY | 2021 | 15 | County 1 | Cx pipiens | 1 | 6 | CO2 | 0.1667
AGENCY | 2021 | 16 | County 1 | Cx tarsalis | 7 | 11 | CO2 | 0.6364
AGENCY | 2021 | 16 | County 1 | Cx pipiens | 73 | 11 | CO2 | 6.6364
AGENCY | 2021 | 17 | County 1 | Cx tarsalis | 354 | 7 | CO2 | 50.5714
AGENCY | 2021 | 17 | County 1 | Cx pipiens | 17 | 7 | CO2 | 2.4286
AGENCY | 2021 | 18 | County 1 | Cx tarsalis | 8 | 4 | CO2 | 2.0000
AGENCY | 2021 | 18 | County 1 | Cx pipiens | 0 | 4 | CO2 | 0.0000
AGENCY | 2021 | 19 | County 1 | Cx tarsalis | 29 | 6 | CO2 | 4.8333
AGENCY | 2021 | 19 | County 1 | Cx pipiens | 0 | 6 | CO2 | 0.0000
AGENCY | 2021 | 20 | County 1 | Cx tarsalis | 0 | 9 | CO2 | 0.0000
AGENCY | 2021 | 20 | County 1 | Cx pipiens | 57 | 9 | CO2 | 6.3333
AGENCY | 2021 | 21 | County 1 | Cx tarsalis | 5 | 3 | CO2 | 1.6667
AGENCY | 2021 | 21 | County 1 | Cx pipiens | 9 | 3 | CO2 | 3.0000
AGENCY | 2021 | 22 | County 1 | Cx tarsalis | 0 | 1 | CO2 | 0.0000
AGENCY | 2021 | 22 | County 1 | Cx pipiens | 0 | 1 | CO2 | 0.0000
AGENCY | 2020 | 9 | County 1 | Cx tarsalis | 0 | 3 | CO2 | 0.0000
AGENCY | 2020 | 9 | County 1 | Cx pipiens | 1 | 3 | CO2 | 0.3333
AGENCY | 2020 | 10 | County 1 | Cx tarsalis | 0 | 7 | CO2 | 0.0000
AGENCY | 2020 | 10 | County 1 | Cx pipiens | 4 | 7 | CO2 | 0.5714
AGENCY | 2020 | 11 | County 1 | Cx tarsalis | 9 | 11 | CO2 | 0.8182
AGENCY | 2020 | 11 | County 1 | Cx pipiens | 18 | 11 | CO2 | 1.6364
AGENCY | 2020 | 12 | County 1 | Cx tarsalis | 1 | 9 | CO2 | 0.1111
AGENCY | 2020 | 12 | County 1 | Cx pipiens | 0 | 9 | CO2 | 0.0000
AGENCY | 2020 | 13 | County 1 | Cx tarsalis | 0 | 5 | CO2 | 0.0000
AGENCY | 2020 | 13 | County 1 | Cx pipiens | 81 | 5 | CO2 | 16.2000
AGENCY | 2020 | 14 | County 1 | Cx tarsalis | 1717 | 9 | CO2 | 190.7778
AGENCY | 2020 | 14 | County 1 | Cx pipiens | 14 | 9 | CO2 | 1.5556
AGENCY | 2020 | 15 | County 1 | Cx tarsalis | 63 | 6 | CO2 | 10.5000
AGENCY | 2020 | 15 | County 1 | Cx pipiens | 0 | 6 | CO2 | 0.0000
AGENCY | 2020 | 16 | County 1 | Cx tarsalis | 207 | 8 | CO2 | 25.8750
AGENCY | 2020 | 16 | County 1 | Cx pipiens | 67 | 8 | CO2 | 8.3750
AGENCY | 2020 | 17 | County 1 | Cx tarsalis | 15 | 6 | CO2 | 2.5000
AGENCY | 2020 | 17 | County 1 | Cx pipiens | 2 | 6 | CO2 | 0.3333
AGENCY | 2020 | 18 | County 1 | Cx tarsalis | 499 | 4 | CO2 | 124.7500
AGENCY | 2020 | 18 | County 1 | Cx pipiens | 4 | 4 | CO2 | 1.0000
AGENCY | 2020 | 19 | County 1 | Cx tarsalis | 58 | 14 | CO2 | 4.1429
AGENCY | 2020 | 19 | County 1 | Cx pipiens | 15 | 14 | CO2 | 1.0714
AGENCY | 2020 | 20 | County 1 | Cx tarsalis | 1 | 5 | CO2 | 0.2000
AGENCY | 2020 | 20 | County 1 | Cx pipiens | 0 | 5 | CO2 | 0.0000
AGENCY | 2020 | 21 | County 1 | Cx tarsalis | 0 | 7 | CO2 | 0.0000
AGENCY | 2020 | 21 | County 1 | Cx pipiens | 145 | 7 | CO2 | 20.7143
AGENCY | 2020 | 22 | County 1 | Cx tarsalis | 0 | 7 | CO2 | 0.0000
AGENCY | 2020 | 22 | County 1 | Cx pipiens | 20 | 7 | CO2 | 2.8571
AGENCY | 2020 | 23 | County 1 | Cx tarsalis | 5 | 4 | CO2 | 1.2500
AGENCY | 2020 | 23 | County 1 | Cx pipiens | 3 | 4 | CO2 | 0.7500
AGENCY | 2020 | 24 | County 1 | Cx tarsalis | 0 | 1 | CO2 | 0.0000
AGENCY | 2020 | 24 | County 1 | Cx pipiens | 0 | 1 | CO2 | 0.0000
AGENCY | 2019 | 9 | County 1 | Cx tarsalis | 101 | 10 | CO2 | 10.1000
AGENCY | 2019 | 9 | County 1 | Cx pipiens | 15 | 10 | CO2 | 1.5000
AGENCY | 2019 | 10 | County 1 | Cx tarsalis | 0 | 5 | CO2 | 0.0000
AGENCY | 2019 | 10 | County 1 | Cx pipiens | 15 | 5 | CO2 | 3.0000
AGENCY | 2019 | 11 | County 1 | Cx tarsalis | 590 | 13 | CO2 | 45.3846
AGENCY | 2019 | 11 | County 1 | Cx pipiens | 7 | 13 | CO2 | 0.5385
AGENCY | 2019 | 12 | County 1 | Cx tarsalis | 0 | 4 | CO2 | 0.0000
AGENCY | 2019 | 12 | County 1 | Cx pipiens | 2 | 4 | CO2 | 0.5000
AGENCY | 2019 | 13 | County 1 | Cx tarsalis | 596 | 5 | CO2 | 119.2000
AGENCY | 2019 | 13 | County 1 | Cx pipiens | 0 | 5 | CO2 | 0.0000
AGENCY | 2019 | 14 | County 1 | Cx tarsalis | 60 | 4 | CO2 | 15.0000
AGENCY | 2019 | 14 | County 1 | Cx pipiens | 0 | 4 | CO2 | 0.0000
AGENCY | 2019 | 15 | County 1 | Cx tarsalis | 4841 | 10 | CO2 | 484.1000
AGENCY | 2019 | 15 | County 1 | Cx pipiens | 46 | 10 | CO2 | 4.6000
AGENCY | 2019 | 16 | County 1 | Cx tarsalis | 103 | 15 | CO2 | 6.8667
AGENCY | 2019 | 16 | County 1 | Cx pipiens | 2089 | 15 | CO2 | 139.2667
AGENCY | 2019 | 17 | County 1 | Cx tarsalis | 446 | 6 | CO2 | 74.3333
AGENCY | 2019 | 17 | County 1 | Cx pipiens | 1950 | 6 | CO2 | 325.0000
AGENCY | 2019 | 18 | County 1 | Cx tarsalis | 4475 | 11 | CO2 | 406.8182
AGENCY | 2019 | 18 | County 1 | Cx pipiens | 1622 | 11 | CO2 | 147.4545
AGENCY | 2019 | 19 | County 1 | Cx tarsalis | 93 | 6 | CO2 | 15.5000
AGENCY | 2019 | 19 | County 1 | Cx pipiens | 43 | 6 | CO2 | 7.1667
AGENCY | 2019 | 20 | County 1 | Cx tarsalis | 0 | 2 | CO2 | 0.0000
AGENCY | 2019 | 20 | County 1 | Cx pipiens | 0 | 2 | CO2 | 0.0000
AGENCY | 2019 | 21 | County 1 | Cx tarsalis | 37 | 8 | CO2 | 4.6250
AGENCY | 2019 | 21 | County 1 | Cx pipiens | 64 | 8 | CO2 | 8.0000
AGENCY | 2018 | 10 | County 1 | Cx tarsalis | 343 | 7 | CO2 | 49.0000
AGENCY | 2018 | 10 | County 1 | Cx pipiens | 3 | 7 | CO2 | 0.4286
AGENCY | 2018 | 11 | County 1 | Cx tarsalis | 87 | 19 | CO2 | 4.5789
AGENCY | 2018 | 11 | County 1 | Cx pipiens | 126 | 19 | CO2 | 6.6316
AGENCY | 2018 | 12 | County 1 | Cx tarsalis | 0 | 10 | CO2 | 0.0000
AGENCY | 2018 | 12 | County 1 | Cx pipiens | 7 | 10 | CO2 | 0.7000
AGENCY | 2018 | 13 | County 1 | Cx tarsalis | 3013 | 10 | CO2 | 301.3000
AGENCY | 2018 | 13 | County 1 | Cx pipiens | 11 | 10 | CO2 | 1.1000
AGENCY | 2018 | 14 | County 1 | Cx tarsalis | 196 | 10 | CO2 | 19.6000
AGENCY | 2018 | 14 | County 1 | Cx pipiens | 35 | 10 | CO2 | 3.5000
AGENCY | 2018 | 15 | County 1 | Cx tarsalis | 601 | 7 | CO2 | 85.8571
AGENCY | 2018 | 15 | County 1 | Cx pipiens | 445 | 7 | CO2 | 63.5714
AGENCY | 2018 | 16 | County 1 | Cx tarsalis | 1649 | 5 | CO2 | 329.8000
AGENCY | 2018 | 16 | County 1 | Cx pipiens | 0 | 5 | CO2 | 0.0000
AGENCY | 2018 | 17 | County 1 | Cx tarsalis | 6 | 8 | CO2 | 0.7500
AGENCY | 2018 | 17 | County 1 | Cx pipiens | 120 | 8 | CO2 | 15.0000
AGENCY | 2018 | 18 | County 1 | Cx tarsalis | 258 | 7 | CO2 | 36.8571
AGENCY | 2018 | 18 | County 1 | Cx pipiens | 0 | 7 | CO2 | 0.0000
AGENCY | 2018 | 19 | County 1 | Cx tarsalis | 243 | 10 | CO2 | 24.3000
AGENCY | 2018 | 19 | County 1 | Cx pipiens | 278 | 10 | CO2 | 27.8000
AGENCY | 2018 | 20 | County 1 | Cx tarsalis | 2 | 10 | CO2 | 0.2000
AGENCY | 2018 | 20 | County 1 | Cx pipiens | 62 | 10 | CO2 | 6.2000
AGENCY | 2018 | 21 | County 1 | Cx tarsalis | 12 | 7 | CO2 | 1.7143
AGENCY | 2018 | 21 | County 1 | Cx pipiens | 23 | 7 | CO2 | 3.2857
AGENCY | 2017 | 4 | County 1 | Cx tarsalis | 2 | 1 | CO2 | 2.0000
AGENCY | 2017 | 4 | County 1 | Cx pipiens | 0 | 1 | CO2 | 0.0000
AGENCY | 2017 | 8 | County 1 | Cx tarsalis | 0 | 1 | CO2 | 0.0000
AGENCY | 2017 | 8 | County 1 | Cx pipiens | 0 | 1 | CO2 | 0.0000
AGENCY | 2017 | 9 | County 1 | Cx tarsalis | 0 | 11 | CO2 | 0.0000
AGENCY | 2017 | 9 | County 1 | Cx pipiens | 8 | 11 | CO2 | 0.7273
AGENCY | 2017 | 10 | County 1 | Cx tarsalis | 56 | 13 | CO2 | 4.3077
AGENCY | 2017 | 10 | County 1 | Cx pipiens | 11 | 13 | CO2 | 0.8462
AGENCY | 2017 | 11 | County 1 | Cx tarsalis | 434 | 8 | CO2 | 54.2500
AGENCY | 2017 | 11 | County 1 | Cx pipiens | 418 | 8 | CO2 | 52.2500
AGENCY | 2017 | 12 | County 1 | Cx tarsalis | 287 | 11 | CO2 | 26.0909
AGENCY | 2017 | 12 | County 1 | Cx pipiens | 24 | 11 | CO2 | 2.1818
AGENCY | 2017 | 13 | County 1 | Cx tarsalis | 8 | 9 | CO2 | 0.8889
AGENCY | 2017 | 13 | County 1 | Cx pipiens | 392 | 9 | CO2 | 43.5556
AGENCY | 2017 | 14 | County 1 | Cx tarsalis | 543 | 10 | CO2 | 54.3000
AGENCY | 2017 | 14 | County 1 | Cx pipiens | 726 | 10 | CO2 | 72.6000
AGENCY | 2017 | 15 | County 1 | Cx tarsalis | 1629 | 16 | CO2 | 101.8125
AGENCY | 2017 | 15 | County 1 | Cx pipiens | 391 | 16 | CO2 | 24.4375
AGENCY | 2017 | 16 | County 1 | Cx tarsalis | 341 | 10 | CO2 | 34.1000
AGENCY | 2017 | 16 | County 1 | Cx pipiens | 460 | 10 | CO2 | 46.0000
AGENCY | 2017 | 17 | County 1 | Cx tarsalis | 2344 | 13 | CO2 | 180.3077
AGENCY | 2017 | 17 | County 1 | Cx pipiens | 163 | 13 | CO2 | 12.5385
AGENCY | 2017 | 18 | County 1 | Cx tarsalis | 1672 | 12 | CO2 | 139.3333
AGENCY | 2017 | 18 | County 1 | Cx pipiens | 436 | 12 | CO2 | 36.3333
AGENCY | 2017 | 19 | County 1 | Cx tarsalis | 12 | 11 | CO2 | 1.0909
AGENCY | 2017 | 19 | County 1 | Cx pipiens | 40 | 11 | CO2 | 3.6364
AGENCY | 2017 | 20 | County 1 | Cx tarsalis | 101 | 11 | CO2 | 9.1818
AGENCY | 2017 | 20 | County 1 | Cx pipiens | 40 | 11 | CO2 | 3.6364
AGENCY | 2017 | 21 | County 1 | Cx tarsalis | 32 | 14 | CO2 | 2.2857
AGENCY | 2017 | 21 | County 1 | Cx pipiens | 28 | 14 | CO2 | 2.0000
AGENCY | 2016 | 8 | County 1 | Cx tarsalis | 2 | 7 | CO2 | 0.2857
AGENCY | 2016 | 8 | County 1 | Cx pipiens | 1 | 7 | CO2 | 0.1429
AGENCY | 2016 | 9 | County 1 | Cx tarsalis | 34 | 13 | CO2 | 2.6154
AGENCY | 2016 | 9 | County 1 | Cx pipiens | 12 | 13 | CO2 | 0.9231
AGENCY | 2016 | 10 | County 1 | Cx tarsalis | 110 | 8 | CO2 | 13.7500
AGENCY | 2016 | 10 | County 1 | Cx pipiens | 16 | 8 | CO2 | 2.0000
AGENCY | 2016 | 11 | County 1 | Cx tarsalis | 3 | 9 | CO2 | 0.3333
AGENCY | 2016 | 11 | County 1 | Cx pipiens | 16 | 9 | CO2 | 1.7778
AGENCY | 2016 | 12 | County 1 | Cx tarsalis | 1 | 7 | CO2 | 0.1429
AGENCY | 2016 | 12 | County 1 | Cx pipiens | 253 | 7 | CO2 | 36.1429
AGENCY | 2016 | 13 | County 1 | Cx tarsalis | 718 | 12 | CO2 | 59.8333
AGENCY | 2016 | 13 | County 1 | Cx pipiens | 23 | 12 | CO2 | 1.9167
AGENCY | 2016 | 14 | County 1 | Cx tarsalis | 1105 | 13 | CO2 | 85.0000
AGENCY | 2016 | 14 | County 1 | Cx pipiens | 1354 | 13 | CO2 | 104.1538
AGENCY | 2016 | 15 | County 1 | Cx tarsalis | 1419 | 10 | CO2 | 141.9000
AGENCY | 2016 | 15 | County 1 | Cx pipiens | 285 | 10 | CO2 | 28.5000
AGENCY | 2016 | 16 | County 1 | Cx tarsalis | 1295 | 10 | CO2 | 129.5000
AGENCY | 2016 | 16 | County 1 | Cx pipiens | 2032 | 10 | CO2 | 203.2000
AGENCY | 2016 | 17 | County 1 | Cx tarsalis | 2641 | 15 | CO2 | 176.0667
AGENCY | 2016 | 17 | County 1 | Cx pipiens | 99 | 15 | CO2 | 6.6000
AGENCY | 2016 | 18 | County 1 | Cx tarsalis | 9 | 11 | CO2 | 0.8182
AGENCY | 2016 | 18 | County 1 | Cx pipiens | 53 | 11 | CO2 | 4.8182
AGENCY | 2016 | 19 | County 1 | Cx tarsalis | 14 | 7 | CO2 | 2.0000
AGENCY | 2016 | 19 | County 1 | Cx pipiens | 15 | 7 | CO2 | 2.1429
AGENCY | 2016 | 20 | County 1 | Cx tarsalis | 5 | 16 | CO2 | 0.3125
AGENCY | 2016 | 20 | County 1 | Cx pipiens | 15 | 16 | CO2 | 0.9375
AGENCY | 2016 | 21 | County 1 | Cx tarsalis | 2 | 6 | CO2 | 0.3333
AGENCY | 2016 | 21 | County 1 | Cx pipiens | 109 | 6 | CO2 | 18.1667
AGENCY | 2015 | 8 | County 1 | Cx tarsalis | 0 | 4 | CO2 | 0.0000
AGENCY | 2015 | 8 | County 1 | Cx pipiens | 3 | 4 | CO2 | 0.7500
AGENCY | 2015 | 9 | County 1 | Cx tarsalis | 33 | 12 | CO2 | 2.7500
AGENCY | 2015 | 9 | County 1 | Cx pipiens | 26 | 12 | CO2 | 2.1667
AGENCY | 2015 | 10 | County 1 | Cx tarsalis | 76 | 15 | CO2 | 5.0667
AGENCY | 2015 | 10 | County 1 | Cx pipiens | 88 | 15 | CO2 | 5.8667
AGENCY | 2015 | 11 | County 1 | Cx tarsalis | 53 | 5 | CO2 | 10.6000
AGENCY | 2015 | 11 | County 1 | Cx pipiens | 87 | 5 | CO2 | 17.4000
AGENCY | 2015 | 12 | County 1 | Cx tarsalis | 225 | 11 | CO2 | 20.4545
AGENCY | 2015 | 12 | County 1 | Cx pipiens | 131 | 11 | CO2 | 11.9091
AGENCY | 2015 | 13 | County 1 | Cx tarsalis | 258 | 17 | CO2 | 15.1765
AGENCY | 2015 | 13 | County 1 | Cx pipiens | 277 | 17 | CO2 | 16.2941
AGENCY | 2015 | 14 | County 1 | Cx tarsalis | 650 | 10 | CO2 | 65.0000
AGENCY | 2015 | 14 | County 1 | Cx pipiens | 14 | 10 | CO2 | 1.4000
AGENCY | 2015 | 15 | County 1 | Cx tarsalis | 1353 | 10 | CO2 | 135.3000
AGENCY | 2015 | 15 | County 1 | Cx pipiens | 74 | 10 | CO2 | 7.4000
AGENCY | 2015 | 16 | County 1 | Cx tarsalis | 4341 | 14 | CO2 | 310.0714
AGENCY | 2015 | 16 | County 1 | Cx pipiens | 514 | 14 | CO2 | 36.7143
AGENCY | 2015 | 17 | County 1 | Cx tarsalis | 13 | 8 | CO2 | 1.6250
AGENCY | 2015 | 17 | County 1 | Cx pipiens | 105 | 8 | CO2 | 13.1250
AGENCY | 2015 | 18 | County 1 | Cx tarsalis | 0 | 6 | CO2 | 0.0000
AGENCY | 2015 | 18 | County 1 | Cx pipiens | 9 | 6 | CO2 | 1.5000
AGENCY | 2015 | 19 | County 1 | Cx tarsalis | 140 | 15 | CO2 | 9.3333
AGENCY | 2015 | 19 | County 1 | Cx pipiens | 83 | 15 | CO2 | 5.5333
AGENCY | 2015 | 20 | County 1 | Cx tarsalis | 56 | 12 | CO2 | 4.6667
AGENCY | 2015 | 20 | County 1 | Cx pipiens | 51 | 12 | CO2 | 4.2500
AGENCY | 2015 | 21 | County 1 | Cx tarsalis | 32 | 4 | CO2 | 8.0000
AGENCY | 2015 | 21 | County 1 | Cx pipiens | 44 | 4 | CO2 | 11.0000
AGENCY | 2015 | 23 | County 1 | Cx tarsalis | 0 | 2 | CO2 | 0.0000
AGENCY | 2015 | 23 | County 1 | Cx pipiens | 0 | 2 | CO2 | 0.0000
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 | 2318 | 90 | 11158 | 14163 | 13535 | 18943
BTLJC | 30 | 33 | 63 | 0 | 0 | 0
CDCAGO | 20 | 0 | 0 | 0 | 0 | 0
CO2 | 12201 | 11622 | 10901 | 9719 | 12364 | 13475
FLANNEL | 3 | 3 | 9 | 14 | 11 | 6
GRVD | 9560 | 10184 | 9221 | 8611 | 9069 | 8910
LCKR | 1434 | 3119 | 3707 | 3693 | 3559 | 3831
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

###