tx_ml: Subset Clients who Became Inactive (IIT) Within a Given...

View source: R/tx_ml.R

tx_mlR Documentation

Subset Clients who Became Inactive (IIT) Within a Given Period

Description

tx_ml Generates clients who have become inactive over a specified period of time. The default is to generate all clients who became inactive in the current Fiscal Year. You can specify the period of interest (using the from and to arguments). Used together with tx_ml_outcomes(), generates inactive clients with a particular outcome of interest.

Usage

tx_ml(
  new_data,
  old_data = NULL,
  from = NULL,
  to = NULL,
  states = NULL,
  facilities = NULL,
  status = "default",
  remove_duplicates = FALSE
)

Arguments

new_data

The current datafame where changes in current treatment status will be checked.

old_data

The initial dataframe containing the list of clients who were previously active.

from

The start date in ISO8601 format (i.e. "yyyy-mm-dd"). The default is to start at the beginning of the current Fiscal Year (i.e. 1st of October).

to

The end date written in ISO8601 format (i.e. "yyyy-mm-dd"). The default is the date of analysis.

states

The name(s) of the State(s) of interest. The default utilizes all the states in the dataframe. If specifying more than one state, combine the states using the c() e.g. c("State 1", "State 2").

facilities

The name(s) of the facilit(ies) of interest. Default is to utilize all the facilities contained in the dataframe. If specifying more than one facility, combine the facilities using the c() e.g. c("Facility 1", "Facility 2").

status

Determines how the number of active clients is calculated. The options are to either to use the NDR current_status_28_days column or the derived current_status column ("calculated").

remove_duplicates

Boolean argument. It specifies if duplicate patient entries in the facilities should be removed or kept

Value

tx_ml

Examples

tx_ml(new_data = ndr_example, from = "2021-06-01")

# Find clients who were inactive in Q4 of FY21
tx_ml(
  new_data = ndr_example,
  from = "2021-07-01", to = "2021-09-30"
)

## generate line-list of `tx_ml()` using two datasets

file_path <- "https://raw.githubusercontent.com/stephenbalogun/example_files/main/ndr_example.csv"
ndr_old <- read_ndr(file_path, time_stamp = "2021-02-15")
ndr_new <- ndr_example
tx_ml(
  old_data = ndr_old,
  new_data = ndr_new,
  from = "2021-07-01",
  to = "2021-09-30"
)


tidyndr documentation built on April 8, 2022, 9:06 a.m.