tx_rtt: Subset Rows of Previously Inactive Clients Who are Now Active

View source: R/tx_rtt.R

tx_rttR Documentation

Subset Rows of Previously Inactive Clients Who are Now Active

Description

Generates the line-list of clients who were inactive in the data supplied to the old_data argument but have now become active in the data supplied to the new_data argument.

Usage

tx_rtt(
  new_data,
  old_data,
  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 have been previously inactive.

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_rtt

Examples


file_path <- "https://raw.githubusercontent.com/stephenbalogun/example_files/main/ndr_example.csv"
ndr_new <- read_ndr(file_path, time_stamp = "2021-02-15")
ndr_old <- ndr_example
tx_rtt(ndr_new, ndr_old)


## Determine RTT for a particular state

tx_rtt(ndr_old, ndr_new, states = "State 1")


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