Learn R Programming

gfoRmula (version 1.1.1)

visit_sum: Create Visit Sum Covariate

Description

This internal function assists in the implementation of a visit process by creating a covariate, ts_visit, that counts the number of visits in the past max_visits time points. If this number is greater than 0, then the individual has not missed more than the maximum number of visits.

Usage

visit_sum(pool, histvars, time_name, t, id_name, max_visits)

Value

No value is returned. The data table pool is modified in place.

Arguments

pool

Data table containing all information prior to time \(t\) (\(t\) noninclusive).

histvars

Vector of character strings specifying the names of the variables for which lagged cumulative averages are to be created.

time_name

Character string specifying the name of the time variable in pool.

t

Integer specifying the current time index.

id_name

Character string specifying the name of the ID variable in pool.

max_visits

A vector of one or more values denoting the maximum number of times a binary covariate representing a visit process may be missed before the individual is censored from the data (in the observed data) or a visit is forced (in the simulated data). Multiple values exist in the vector when the modeling of more than covariate is attached to a visit process.