verify_ts: verify timeseries data.frame format and contents

Description Usage Arguments Value Examples

View source: R/verify_ts.R

Description

Checks to see a given data.frame meets project criteria

Usage

1
2
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

1
2
3
4
5
6
7
8
9
## 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 Dec. 19, 2017, 10:25 p.m.