Skip to contents

Assign threshold categories to Fecal Indicator Bacteria (FIB) data

Usage

anlz_fibmap(fibdata, yrsel = NULL, mosel = NULL, areasel = NULL, assf = FALSE)

Arguments

fibdata

input FIB data.frame as returned by read_importfib or read_importwqp, see details

yrsel

optional numeric value to filter output by years in fibdata

mosel

optional numeric value to filter output by month in fibdata

areasel

optional character string to filter output by stations in the area column of fibdata, see details

assf

logical indicating if the data are further processed as a simple features object with additional columns for show_fibmap

Value

A data.frame if similar to fibdata or mancofibdata if assf = FALSE with additional columns describing station categories and optionally filtered by arguments passed to the function. A sf object if assf = TRUE with additional columns for show_fibmap.

Details

This function is used to create FIB categories for mapping using show_fibmap. Categories based on relevant thresholds are assigned to each observation. The categories are specific to E. coli or Enterococcus and are assigned based on the station class as freshwater (class as 1 or 3F) or marine (class as 2 or 3M), respectively. A station is categorized into one of four ranges defined by the thresholds as noted in the cat column of the output, with corresponding colors appropriate for each range as noted in the col column of the output.

Data from Manatee County (21FLMANA_WQX) returned by read_importwqp can be used with this function. Data from other organizations returned by this function have not been tested.

The areasel argument can indicate valid entries in the area column of fibdata (from read_importfib) or mancofibdata (from read_importwqp). For example, use either "Alafia River" or "Hillsborough River" for the corresponding river basins, where rows in fibdata are filtered based on the the selection. All stations are returned if this argument is set as NULL (default). The Alafia River basin includes values in the area column of fibdata as "Alafia River" and "Alafia River Tributary". The Hillsborough River basin includes values in the area column of fibdata as "Hillsborough River", "Hillsborough River Tributary", "Lake Thonotosassa", "Lake Thonotosassa Tributary", and "Lake Roberta". Not all areas may be present based on the selection.

All valid options for areasel for fibdata include "Alafia River", "Hillsborough River", "Big Bend", "Cockroach Bay", "East Lake Outfall", "Hillsborough Bay", "Little Manatee", "Lower Tampa Bay", "McKay Bay", "Middle Tampa Bay", "Old Tampa Bay", "Palm River", "Tampa Bypass Canal", or "Valrico Lake". One to any of the options can be used.

Valid entries for areasel for mancofibdata include "Big Slough", "Bowlees Creek", "Braden River", "Bud Slough", "Clay Gully", "Frog Creek", "Gap Creek", "Little Manatee River", "Lower Tampa Bay", "Manatee River", "Mcmullen Creek", "Mud Lake Slough", "Myakka River", "Palma Sola Bay", or "Piney Point Creek". One to any of the options can be used.

Examples

# assign categories to all
anlz_fibmap(fibdata)
#> # A tibble: 77,526 × 12
#>    area    station class    yr    mo Latitude Longitude ecoli entero ind   cat  
#>    <chr>     <dbl> <chr> <dbl> <dbl>    <dbl>     <dbl> <dbl>  <dbl> <chr> <fct>
#>  1 Hillsb…       2 3M     2024     6     27.9     -82.5    NA      3 Ente… < 35 
#>  2 Hillsb…       6 3M     2024     6     27.9     -82.5    NA      8 Ente… < 35 
#>  3 Hillsb…       7 3M     2024     6     27.9     -82.5    NA      2 Ente… < 35 
#>  4 Hillsb…       8 3M     2024     6     27.9     -82.4    NA      4 Ente… < 35 
#>  5 Middle…       9 2      2024     6     27.8     -82.4    NA      2 Ente… < 35 
#>  6 Middle…      11 2      2024     6     27.8     -82.5    NA      2 Ente… < 35 
#>  7 Middle…      13 2      2024     6     27.8     -82.5    NA      2 Ente… < 35 
#>  8 Middle…      14 2      2024     6     27.8     -82.5    NA      2 Ente… < 35 
#>  9 Middle…      16 2      2024     6     27.7     -82.5    NA      4 Ente… < 35 
#> 10 Middle…      19 2      2024     6     27.7     -82.6    NA      2 Ente… < 35 
#> # ℹ 77,516 more rows
#> # ℹ 1 more variable: col <chr>

# filter by year, month, and area
anlz_fibmap(fibdata, yrsel = 2020, mosel = 7, areasel = 'Alafia River')
#> # A tibble: 24 × 12
#>    area    station class    yr    mo Latitude Longitude ecoli entero ind   cat  
#>    <chr>     <dbl> <chr> <dbl> <dbl>    <dbl>     <dbl> <dbl>  <dbl> <chr> <fct>
#>  1 Alafia…      74 3M     2020     7     27.9     -82.4    NA    168 Ente… 130 …
#>  2 Alafia…     111 3F     2020     7     27.9     -82.2    50   7000 E. c… < 126
#>  3 Alafia…     114 3F     2020     7     27.9     -82.3   447   1560 E. c… 410 …
#>  4 Alafia…     115 3F     2020     7     27.9     -82.1    80    260 E. c… < 126
#>  5 Alafia…     116 3F     2020     7     27.9     -82.1    30    367 E. c… < 126
#>  6 Alafia…     139 3F     2020     7     27.7     -82.1    47    100 E. c… < 126
#>  7 Alafia…     151 3F     2020     7     27.9     -82.2    90     25 E. c… < 126
#>  8 Alafia…     153 3M     2020     7     27.9     -82.3    NA   4000 Ente… > 999
#>  9 Alafia…     154 3F     2020     7     27.9     -82.1   433   1367 E. c… 410 …
#> 10 Alafia…     155 3F     2020     7     27.9     -82.2   170    233 E. c… 126 …
#> # ℹ 14 more rows
#> # ℹ 1 more variable: col <chr>

# as sf object
anlz_fibmap(fibdata, assf = TRUE)
#> Simple feature collection with 28287 features and 16 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -82.7832 ymin: 27.53248 xmax: -82.05604 ymax: 28.16544
#> Geodetic CRS:  WGS 84
#> # A tibble: 28,287 × 17
#>    area    station class    yr    mo Latitude Longitude ecoli entero ind   cat  
#>    <chr>     <dbl> <chr> <dbl> <dbl>    <dbl>     <dbl> <dbl>  <dbl> <chr> <fct>
#>  1 Hillsb…       2 3M     2024     6     27.9     -82.5    NA      3 Ente… < 35 
#>  2 Hillsb…       6 3M     2024     6     27.9     -82.5    NA      8 Ente… < 35 
#>  3 Hillsb…       7 3M     2024     6     27.9     -82.5    NA      2 Ente… < 35 
#>  4 Hillsb…       8 3M     2024     6     27.9     -82.4    NA      4 Ente… < 35 
#>  5 Middle…       9 2      2024     6     27.8     -82.4    NA      2 Ente… < 35 
#>  6 Middle…      11 2      2024     6     27.8     -82.5    NA      2 Ente… < 35 
#>  7 Middle…      13 2      2024     6     27.8     -82.5    NA      2 Ente… < 35 
#>  8 Middle…      14 2      2024     6     27.8     -82.5    NA      2 Ente… < 35 
#>  9 Middle…      16 2      2024     6     27.7     -82.5    NA      4 Ente… < 35 
#> 10 Middle…      19 2      2024     6     27.7     -82.6    NA      2 Ente… < 35 
#> # ℹ 28,277 more rows
#> # ℹ 6 more variables: col <chr>, geometry <POINT [°]>, grp <fct>, conc <dbl>,
#> #   cls <chr>, lab <chr>