CasesTable: Create reports cases after listwise deletion of missing...

Description Usage Arguments Value Examples

View source: R/CasesTable.R

Description

Create reports cases after listwise deletion of missing values for time-series cross-sectional data.

Usage

1
CasesTable(data, GroupVar, TimeVar, Vars)

Arguments

data

a data frame with the full sample.

GroupVar

a character string specifying the variable in data which contains the group IDs.

TimeVar

an optional character string specifying the variable in data which contains the time variable.

Vars

a character vector with variables names from data for which you would like to listwise delete observations with missing values.

Value

If TimeVar is specified then a data frame is returned with three colums. One identifying the GroupVar and two others specifying each unique value of GroupVar's first and last observation time post-listwise deletion of missing values.

If TimeVar is not specified, then a vector of unique GroupVar post-listwise deletion of missing values is returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Create dummy data
ID <- rep(1:4, 4)
time <- rep(2000:2003, 4)
a <- rep(c(1:3, NA), 4)
b <- rep(c(1, NA, 3:4), 4)
Data <- data.frame(ID, time, a, b)

# Find cases that have not been listwise deleted
CasesTable(Data, GroupVar = 'ID')
CasesTable(Data, GroupVar = 'ID', Vars = 'a')
CasesTable(Data, GroupVar = 'ID', TimeVar = 'time', Vars = 'a')

DataCombine documentation built on May 30, 2017, 2:52 a.m.