Skip to contents

Background

The Tampa Bay Nekton Index (TBNI) [1,2]) is a multimetric assessment method that quantifies the ecological health of the nekton community in Tampa Bay. The index provides a complementary approach to evaluating environmental condition that is supported by other assessment methods currently available for Tampa Bay (e.g., water quality report card, Benthic index, etc.). The tbeptools package includes several functions described below to import data required for the index, analyze the data to calculate metrics and index scores, and plot the results to view trends over time. Each of the functions are described in detail below.

The TBNI uses catch data from the Florida Fish and Wildlife Conservation Commission (FWC) Fish and Wildlife Research Institute’s (FWRI) Fisheries-Independent Monitoring (FIM) program. Catch results from a center-bag seine have the longest and most consistent record in the FIM database and were used to develop the TBNI. These include counts and taxa identification for individuals caught in near shore areas, generally as early recruits, juveniles, and smaller-bodied nekton. All fish and selected invertebrates are identified to the lowest possible taxon (usually species), counted, and a subset are measured. Current protocols were established in 1998 and TBNI estimates are unavailable prior to this date.

Data import and included datasets

Data required for calculating TBNI scores can be imported into the current R session using the read_importfim() function. This function downloads the latest FIM file from an FTP site if the data have not already been downloaded to the location specified by the input arguments.

To download the data, first create a character path for the location of the file. If one does not exist, specify a desired location and name for the downloaded file. Here, we want to put the file on the desktop in our home directory and name it fimdata.csv.

csv <- '~/Desktop/fimdata.csv'
fimdata <- read_importfim(csv)

Running the above code will return the following error:

#> Error in read_importfim(csv) : file.exists(csv) is not TRUE

We get an error message from the function indicating that the file is not found. This makes sense because the file doesn’t exist yet, so we need to tell the function to download the latest file. This is done by changing the download_latest argument to TRUE (the default is FALSE).

fimdata <- read_importfim(csv, download_latest = T)
#> File ~/Desktop/fimdata.csv does not exist, replacing with downloaded file...

#> trying URL 'ftp://ftp.floridamarine.org/users/fim/tmac/NektonIndex/TampaBay_NektonIndexData.csv' length 11083878 bytes (10.6 MB)

Now we get an indication that the file on the server is being downloaded. When the download is complete, we’ll have the data downloaded and saved to the fimdata object in the current R session.

If we try to run the function again after downloading the data from the server, we get the following message. This check is done to make sure that the data are not unnecessarily downloaded if the current matches the file on the server.

fimdata <- read_importfim(csv, download_latest = T)
#> File is current..

Every time that tbeptools is used to work with the FIM data, read_importfim() should be used to import the data. You will always receive the message File is current... if your local file matches the one on the server. However, new data are regularly collected and posted on the server. If download_latest = TRUE and your local file is out of date, you will receive the following message:

#> Replacing local file with current...

After the data are successfully imported, you can view them from the assigned object:

head(fimdata)
#> # A tibble: 6 × 19
#>   Reference    Sampling_Date Latitude Longitude Zone   Grid NODCCODE  Year Month
#>   <chr>        <date>           <dbl>     <dbl> <chr> <int> <chr>    <dbl> <dbl>
#> 1 TBM19980109… 1998-01-09        28.0     -82.7 A        31 8747020…  1998     1
#> 2 TBM19980109… 1998-01-09        28.0     -82.7 A        31 8805030…  1998     1
#> 3 TBM19980109… 1998-01-09        27.9     -82.7 A        62 6177010…  1998     1
#> 4 TBM19980109… 1998-01-09        27.9     -82.7 A        63 9998000…  1998     1
#> 5 TBM19980109… 1998-01-09        27.9     -82.6 A        65 8820020…  1998     1
#> 6 TBM19980109… 1998-01-09        27.9     -82.6 A        65 8826020…  1998     1
#> # ℹ 10 more variables: Total_N <dbl>, ScientificName <chr>,
#> #   Include_TB_Index <chr>, Hab_Cat <chr>, Est_Cat <chr>, Est_Use <chr>,
#> #   Feeding_Cat <chr>, Feeding_Guild <chr>, Selected_Taxa <chr>,
#> #   bay_segment <chr>

The imported data are formatted for calculating the TBNI. The columns include a Reference for the FIM sampling site, the sampling date, sampling Zone, sampling Grid, NODCCODE as a unique identifier for species, sample year, sample month, total catch as Total_N, scientific name, a column indicating if the species is included in the index, and several columns indicating species-specific information required for the metrics. For the final columns, a separate lookup table is provided in the package that is merged with the imported FIM data. This file, tbnispp, can be viewed anytime the package is loaded:

head(tbnispp)
#>      TSN   NODCCODE               ScientificName Include_TB_Index Hab_Cat
#> 1 173245 8860030201 Acanthostracion quadricornis                Y       B
#> 2 172986 8858030202             Achirus lineatus                Y       B
#> 3 160978 8713070101           Aetobatus narinari                Y       B
#> 4 161121 8739010101                Albula vulpes                Y       P
#> 5  96600 6179140000               Alpheidae spp.                N       B
#> 6 173131 8860020101           Aluterus schoepfii                Y       B
#>   Est_Cat Est_Use Feeding_Cat Feeding_Guild Selected_Taxa
#> 1      MS       O          TS            ZB             N
#> 2      ES       O          TS            ZB             N
#> 3      MS       F          TS            ZB             N
#> 4      MS       S          TS            ZB             Y
#> 5                          DV            DV             N
#> 6      MS       F          TS            HV             N

The read_importfim() function can also return a simple features object of sampled stations in the raw FIM data by setting . These data are matched to the appropriate bay segments for tabulating TBNI scores. The resulting dataset indicates where sampling has occurred and can be mapped with the mapview() function. For ease of use, a dataset named fimstations is included in tbeptools.

fimstations <- read_importfim(csv, download_latest = TRUE, locs = TRUE)
mapview(fimstations, zcol = 'bay_segment')