panel.gaps | R Documentation |
Identifies gaps in observation periods within panel data, marking each record with a flag indicating whether it was preceded by a gap. A gap reflects a missing period of observation between this and the previous record for a subject, which is crucial for assessing data integrity and continuity.
panel.gaps(
dat,
id.name = "id",
t1.name = "t1",
t2.name = "t2",
gap.name = "gap_before",
first.value = 0,
expected.gap.between = 0
)
dat |
A data frame structured as panel data. |
id.name |
The character name of the identifying variable within dat, used to track subjects across multiple rows of data. |
t1.name |
The character name of the time variable within dat representing the start (left endpoint) of observation intervals. |
t2.name |
The character name of the time variable within dat representing the end (right endpoint) of observation intervals. |
gap.name |
A character value specifying the name of the new variable to be created that indicates whether a gap is observed before the record. |
first.value |
The numeric expected beginning time of the observation period for each subject. |
expected.gap.between |
The numeric amount of time expected between the end of one record and the start of the next; defaults to zero for continuous observation without expected gaps. |
Returns the original data frame with an additional column (named according to the gap.name parameter) for each record, indicating whether a gap in observation was detected before that record. The gap flag is determined based on the specified expected beginning time and the expected gap between records. This enhanced data frame is instrumental for subsequent analyses that require understanding of observation continuity and identifying subjects with missing data periods.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.