verify_ts: verify timeseries data.frame format and contents

View source: R/verify_ts.R

verify_tsR Documentation

verify timeseries data.frame format and contents

Description

Checks to see a given data.frame meets project criteria

Usage

verify_ts(data, var, checks = c("ncol", "nrow", "unitted", "tz", "units",
  "names", "NA_values", "NA_dates", "timesteps"), on_fail = warning)

Arguments

data

a unitted data.frame with date and value

var

optional name for timeseries. If supplied, will check variable column name

checks

tests to run on the data ('cols', 'tz', 'units', 'variable')

on_fail

function to call when a test fails. good options are warning and stop. if the function does not halt evaluation, FALSE is returned after the function is first called.

Value

TRUE if is valid, FALSE if not

Examples

## Not run: 
files <- stage_nwis_ts(sites = c("nwis_06893820","nwis_01484680"), var = "doobs",
                 times = c('2014-01-01','2014-02-01'))
files <- download_ts("doobs_nwis", "nwis_01073389", on_local_exists="skip")
ts <- read_ts(files[1]) 
verify_ts(ts, var='doobs', checks=c('ncol','units','names')) # TRUE
verify_ts(ts, var='wtr', checks=c('ncol','units','names')) # warning + FALSE

## End(Not run)

USGS-R/mda.streams documentation built on June 3, 2023, 8:43 a.m.