check_ordered: checks if states within data frame are ordered as inputted...

Description Usage Arguments Details Value Examples

View source: R/agent-to-aggregate.R

Description

This function assesses whether agents's time they enter each state is correctly ordered. The assumption is that these would be ordered in increasing values, with the allowance of NA values not effecting this decision.

Usage

1
check_ordered(df, states, assert_error = TRUE)

Arguments

df

data frame with individual agent information (n x p)

states

time entered state, in expected order

assert_error

boolean if we should raise error if ordering assumption is violated.

Details

If this important assumption is violated this function either raises an error or provides the user with information on what when wrong - to allow the user to how to corect the error (see assert_error to change between these states).

Value

This function returns either

Examples

1
2
3
4
5
df_not_ordered <- data.frame(group1 = 1:5,
                             group2 = c(2:5,1))
output <- check_ordered(df_not_ordered, c("group1", "group2"),
                        assert_error = FALSE)
output

skgallagher/EpiCompare documentation built on Sept. 14, 2021, 5:45 a.m.