mono.flag: Flag

Description Usage Arguments Details Value Author(s) Examples

View source: R/mono.flag.R

Description

This function flags data that is outside the prespecified range and that is not monotonic.

Usage

1
mono.flag(data, id.col, x.col, y.col, min, max, data.r = NULL, tol = 0, direction)

Arguments

data

a data.frame or matrix of measurement data

id.col

column where the id's are stored

x.col

column where x values, or time variable is stored

y.col

column where y values, or measurements are stored

min

lowest acceptable value for measurement; does not have to be a number in ycol

max

highest acceptable value for measurement; does not have to be a number in ycol

data.r

prespecified range for y values; must have three columns: 1 - must match values in xcol, 2 - lower range values, 3 - upper range values

tol

tolerance; how much outside of the range (data.r) is acceptable; same units as data in ycol

direction

the direction of the function a choice between increasing 'inc', and decreasing 'dec'

Details

The data range (data.r) does not need to have the same number of rows as data; it only needs to include the exact time increments as xcol.

Value

Returns the data matrix with two additional columns. "Decreasing" is a logical vector that is TRUE if the observation decreases, or causes the ID to be non-monotonic. "Outside.Range" is a logical vector that returns TRUE if the observation is outside of the data.r +/- tol range. Any duplicate rows are removed.

Author(s)

Michele Josey mjosey@nccu.edu Melyssa Minto mminto@nccu.edu

Examples

1
2
3
4
5
6
data(simulated_data)
simulated_data <- simulated_data[1:1000,]
data(data.r)
## run mono.flag function 
test <- mono.flag(simulated_data, 1, 2, 3, 30, 175, data.r=data.r, direction='inc')
head(test)

MonoInc documentation built on May 2, 2019, 8:18 a.m.