Description Usage Arguments Details Value Author(s) Examples
View source: R/update_sampling_stations.R
Script to modify the internal sampling_sites.rda file for adding new reserves or for making changes to existing sampling station locations.
1 2 3 4 | update_sampling_stations(
file_path = "inst/extdata",
file_name = "sampling_stations.csv"
)
|
file_path |
path to directory with new file |
file_name |
name of new csv file |
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.
Returns TRUE on a successful run, FALSE on a failure.
Dave Eslinger
1 2 3 4 5 6 7 8 9 10 | # Provide a bad file name to get error message
x <- update_sampling_stations("data","bad_file_name.csv")
print(x)
# Commented out example with a valid, but older, filename.
# WARNING! Don't actually run this example unless you have a
# more recent csv file that can be used to update the rda file.
# x <- update_sampling_stations("inst/extdata","NERRS_sampling_stations.csv")
# print(x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.