Learn R Programming

panelr (version 1.0.0)

has_gaps: Check if panel data has gaps

Description

This function checks whether a panel_data() object has implicit gaps (missing rows for some entity-wave combinations).

Usage

has_gaps(data)

Value

A logical value. TRUE if there are gaps, FALSE otherwise.

Arguments

data

A panel_data frame.

See Also

scan_gaps(), balance_panel()

Examples

Run this code
data("WageData")
wages <- panel_data(WageData, id = id, wave = t)
has_gaps(wages)  # FALSE (complete data)

# Create data with gaps
wages_gaps <- wages[wages$t != 3 | wages$id != wages$id[1], ]
has_gaps(wages_gaps)  # TRUE

Run the code above in your browser using DataLab