import_rhs | R Documentation |
The import_rhs
function imports River Habitat Survey (RHS) data. The data can either be downloaded from from data.gov.uk (https://environment.data.gov.uk/portalstg/sharing/rest/content/items/b82d3ef3750d49f6917fff02b9341d68/data) or read in from a local xlsx or rds file. Data can be optionally filtered by survey ID.
import_rhs(source = NULL,
surveys = NULL,
save = FALSE,
save_dwnld = FALSE,
save_dir = getwd(),
rhs_dir = NULL)
source |
Path to local .xlsx or .rds file containing RHS data. If NULL (default), then RHS data is downloaded from data.gov.uk. |
surveys |
Vector of survey ids to filter on. Default = NULL |
save |
Specifies whether (TRUE) or not (FALSE) the filtered data should be saved as an .rds file (for future use, or audit trail). Default = FALSE. |
save_dwnld |
Specifies whether (TRUE) or not (FALSE) the unfiltered file download should be saved, in .rds format. Default = FALSE. |
save_dir |
Path to folder where RHS data is to be saved. Applies to both filtered and unfiltered data; Default = Current working directory. |
rhs_dir |
Deprecated. Path to local .xlsx or .rds file containing RHS data. If NULL (default), then RHS data is downloaded from data.gov.uk. |
This function downloads all data from the RHS database and optionally filters on a specified set of survey IDs.
The save options allow the raw downloaded file (save_dwnld = TRUE) or the filtered file (save = TRUE) to be saved to the working directory.
If saving a copy of the downloaded data, the name of the .rds file is hard-wired to: RHS_survey_summary_ALL.rds. If saving after filtering on site, the name of the rds file is hard-wired to: RHS_survey_summary_F.rds.
Downloaded raw data files (in .xlsx and .zip format) are automatically removed from the working directory following completed execution of the function.
Tibble containing RHS data.
# Download data for all surveys and save as .rds file for future use:
# import_rhs(save_dwnld = TRUE, save_dir = "mydata")
# Read in local .rds file and filter on selected dates:
# import_env(source = "mydata/RHS_survey_summary_ALL.rds",
# surveys = c("34310", "34343"))
# Read in local .xlsx file and filter on selected sites:
# import_rhs(source = "mydata/RHS_ALL.xlsx",
# surveys = c("34310", "34343"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.