lab_change: Determine if a lab changed by a set amount within a specific...

Description Usage Arguments Details Value Examples

Description

lab_change checks for changes in lab values

Usage

1
lab_change(lab.data, change.by, FUN, back = 2)

Arguments

lab.data

A data frame with lab data

change.by

A numeric indicating the threshold for lab changes

FUN

A function for rollapplyr, most commonly max or min

back

An optional numeric specifying the number of days back to go. Defaults to 2 days.

Details

This function takes a data frame with lab data for a single lab and checks whether the lab changes by a certain amount within a given period of time. The parameters should include: change.by, the threshold which the lab must change by; FUN, the function passed to rollapplyr; back, the time frame that the lab change must occur in. For FUN, use max when looking for a decrease in lab value, and min when looking for an increase in lab value.

Value

A data frame

Examples

1
2
3
4
5
## Not run: 
lab_change(data, -2, max, back = 2)
# checks for a >= 2 decrease in the lab value within the past 2 days

## End(Not run)

bgulbis/BGTools documentation built on May 12, 2019, 8:21 p.m.