clean_site_index | R Documentation |
A site index file contains information on when specific ARUs were deployed where. This function cleans a file (csv, xlsx) or data frame in preparation for adding these details to the output of 'clean_metadata()'. It can be used to specify missing information according to date, such as GPS lon/lats and site ids.
clean_site_index(
site_index,
col_aru_id = "aru_id",
col_site_id = "site_id",
col_date_time = "date",
col_coords = c("longitude", "latitude"),
col_extra = NULL,
resolve_overlaps = TRUE,
quiet = FALSE
)
site_index |
Data frame (can be spatial) or file path. Site index data to clean. If file path, must be to a local csv or xlsx file. |
col_aru_id |
Character. Column name that contains ARU ids. Default 'aru_id'. |
col_site_id |
Character. Column name that contains site ids. |
col_date_time |
Character. Column name that contains dates or date/times. Can be vector of two names if there are both 'start' and 'end' columns. Can be 'NULL' to ignore dates. |
col_coords |
Character. Column names that contain longitude and latitude (in that order). Ignored if 'site_index' is spatial. |
col_extra |
Character. Column names for extra data to include. If a named vector, will rename the columns (see examples). |
resolve_overlaps |
Logical. Whether or not to resolve date overlaps by shifting the start/end dates to noon (default 'TRUE'). This assumes that ARUs are generally *not* deployed/removed at midnight (the official start/end of a day) and so noon is used as an approximation for when an ARU was deployed or removed. If possible, use specific deployment times to avoid this issue. |
quiet |
Logical. Whether to suppress progress messages and other non-essential updates. |
Note that times are assumed to be in 'local' time and a timezone isn't used (and is removed if present, replaced with UTC). This allows sites from different timezones to be processed at the same time.
Standardized site index data frame
s <- clean_site_index(example_sites,
col_aru_id = "ARU",
col_site_id = "Sites",
col_date_time = c("Date_set_out", "Date_removed"),
col_coords = c("lon", "lat"))
s <- clean_site_index(example_sites,
col_aru_id = "ARU",
col_site_id = "Sites",
col_date_time = c("Date_set_out", "Date_removed"),
col_coords = c("lon", "lat"),
col_extra = c("plot" = "Plots"))
# Without dates
eg <- dplyr::select(example_sites, -Date_set_out, -Date_removed)
s <- clean_site_index(eg,
col_aru_id = "ARU",
col_site_id = "Sites",
col_date_time = NULL,
col_coords = c("lon", "lat"),
col_extra = c("plot" = "Plots"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.