lag.column: lag.column

Description Usage Arguments Value

Description

lag.column

Usage

1
2
## S3 method for class 'column'
lag(df, c1, nm = "lag.col", backlag = FALSE, sc = NULL)

Arguments

df

a dataframe

c1

name of a column of df

nm

new column name

backlag

direction of lagging

sc

a screening column

Value

a copy of df with a new column in the dataframe that is equal to c1 but shifted either down (backlag = FALSE) or up (backlag = TRUE). Furthermore, if a "screening" column sc is specified, then: For backlag = FALSE, rows that are just above a TRUE in sc are not shifted down - the row with the TRUE in has an NA in the new column (think new patient rows when defining end of last episode) For backlag = TRUE, rows that have a TRUE in sc are not shifted up - the row above the TRUE has an NA in the new column (think new patient rows when defining start of next episode)


HorridTom/clahrcnwlhf documentation built on May 7, 2019, 4:02 a.m.