prep_well_data: prep_well_data: Prepares sentinel well data for conversion to...

View source: R/prep_well_data.R

prep_well_dataR Documentation

prep_well_data: Prepares sentinel well data for conversion to water level using data tables stored in the NETN RAM database (for internal use).

Description

This function pulls in the water level data from the NETN RAM database, joins the location, well visit and water level data together into a wide format of the data with the timestamp as the joining column. Function requires all 8 sites and 2 barometric loggers to run, and only includes data between the spring and fall well visit per year. Must have a the NETN RAM backend database named as a DSN. Function is primarily for internal use.

Usage

prep_well_data(
  path = NULL,
  year = as.numeric(format(Sys.Date(), "%Y")),
  rejected = FALSE,
  growing_season = TRUE,
  export = TRUE,
  quietly = FALSE
)

Arguments

path

Quoted path of the folder where the exported Hobo tables are located.

year

Numeric. The year you are preparing the data for. Function will only run 1 year at a time.

rejected

TRUE or FALSE. If TRUE will include flagged rejected records. If FALSE will replace the rejected flagged records with NA. Defaults to FALSE.

growing_season

TRUE or FALSE. If TRUE will include only growing season measurements, defined as May 15 to Oct. 1. If FALSE, will return all measurements. If growing_season = TRUE and export = TRUE, the output filename will include "GS" Defaults to TRUE.

export

TRUE or FALSE. Export csv file to specified path. Defaults to TRUE.

quietly

TRUE or FALSE. If FALSE, code will not print progress into console. Defaults to FALSE

Value

Returns a wide data frame with timestamp, SITENAME_AbsPres.

Examples

## Not run: 
# Export growing season only data to a table
dir = c('C:/Water_level_data/growing_season_2019')
prep_well_data(path = dir, year = 2019, export = TRUE, growing_season = TRUE)

# Assign output from all 2018 data, including flagged records, to global environment
welld_2018 <- prep_well_data(year = 2018, rejected = TRUE, growing_season = FALSE,
                             export = FALSE)

# Run for 2019 growing season data without printing messages in the console, and save output to file
welld_2018 <- prep_well_data(year = 2019, growing_season = TRUE, export = TRUE,
                             quietly = TRUE)

## End(Not run)


KateMMiller/wetlandACAD documentation built on Oct. 22, 2023, 12:29 a.m.