recdata: Create the rectime data object

Description Usage Arguments Details Value Examples

View source: R/recdata.R

Description

Create the rectime data object used as input of other functions.

Usage

1

Arguments

id

the column name for the subject id in the dataset.

type

the column name for the variable which indicates the type of each observation: 1: event visit; 2: regular visit; 0: censoring.

time

the column name for the time variable.

data

the dataset. Must include: a column for the subject id, a column for the observation type, a column for the time variable and several columns for the covariates. Note that we assume that time variable starts from 0 and it needs to be 'numeric'. The covariates need to be 'numeric' as well.

Details

The rectime data object is a list of two datasets: d.event is for the event observations; d.regular is for the observations at regular visits. The observations with a missing time variable will be deleted: for d.event, the whole subject will be deleted if the time variable is missing in one observation; for d.regular, only the observation with missing time variable will be deleted. In addition, in d.event and d.regular, the column names for subject id, type of observation and censoring time are fixed as: "id", "type", "cent".

Value

A list of two datasets: d.event and d.regular.

Examples

1
2
data(simdata)
recd <- recdata(id="id", type="type", time="time", data=simdata)

TianmengL/rectime documentation built on June 5, 2021, 8:29 p.m.