update_sampling_stations {SWMPrExtension} | R Documentation |
Update reserve sampling stations
Description
Script to modify the internal sampling_sites.rda file for adding new reserves or for making changes to existing sampling station locations.
Usage
update_sampling_stations(file_path, file_name = "sampling_stations.csv")
Arguments
file_path |
path to directory with new file |
file_name |
name of new csv file |
Details
This is a standalone function used to replace the internal SWMPrExtension sampling sites data table used by the get_sites.R function. It reads a csv-formatted file of all NERRS SWMP stations that the user has downloaded from the CDMO SWMP station website: https://cdmo.baruch.sc.edu/data/swmp-stations/.
This downloaded csv-formatted file and its location are the only input arguments to update_sampling_station()
. The current station information is loaded from data/sampling_stations.rda
, a copy of which is written out as data/sampling_stations_backup.rda
, and the new data file is read, formatted appropriately, and written out as data/sampling_stations.rda
.
Note: This function need only be run when new reserves are added, stations are moved, etc.
Value
Returns TRUE on a successful run, FALSE on a failure.
Author(s)
Dave Eslinger
Examples
# Provide a bad file name to get error message
x <- update_sampling_stations("data","bad_file_name.csv")
print(x)