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 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
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
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 x 17 #> Reference Sampling_Date Zone Grid NODCCODE bay_segment Year Month Total_N #> <chr> <date> <chr> <int> <chr> <chr> <dbl> <dbl> <dbl> #> 1 TBM1998010… 1998-01-09 A 31 8747020… OTB 1998 1 15 #> 2 TBM1998010… 1998-01-09 A 31 8805020… OTB 1998 1 2 #> 3 TBM1998010… 1998-01-09 A 62 6177010… OTB 1998 1 1 #> 4 TBM1998010… 1998-01-09 A 63 9998000… OTB 1998 1 0 #> 5 TBM1998010… 1998-01-09 A 65 8820020… OTB 1998 1 1 #> 6 TBM1998010… 1998-01-09 A 65 8826020… OTB 1998 1 1 #> # … with 8 more variables: ScientificName <chr>, Include_TB_Index <chr>, #> # Hab_Cat <chr>, Est_Cat <chr>, Est_Use <chr>, Feeding_Cat <chr>, #> # Feeding_Guild <chr>, Selected_Taxa <chr>
The imported data are formatted for calculating the TBNI. The columns include a
Reference for the FIM sampling site, the sampling date, sampling
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) #> NODCCODE ScientificName Include_TB_Index Hab_Cat Est_Cat #> 1 8860030201 Acanthostracion quadricornis Y B MS #> 2 8858010000 Achiridae spp. N B ES #> 3 8858030202 Achirus lineatus Y B ES #> 4 8804040401 Adinia xenica Y B ES #> 5 8713070101 Aetobatus narinari Y B MS #> 6 8739010101 Albula vulpes Y P MS #> Est_Use Feeding_Cat Feeding_Guild Selected_Taxa #> 1 O TS ZB N #> 2 O TS ZB N #> 3 O TS ZB N #> 4 O TS ZP N #> 5 F TS ZB N #> 6 S TS ZB Y
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')