Learn R Programming

stablespec (version 0.2.3)

dataReshape: Reshape longitudinal data

Description

Reshape longitudinal data with t time slices into a longitudinal data with two time slices.

Usage

dataReshape(theData = NULL, numTime = NULL)

Arguments

theData
a data frame containing longitudinal data to which the model will be fit.
numTime
number of time slices.

Value

A data frame representing longitudinal data with two time slices, such that the first n data points contain the relations that occur in the first two time slices t_0 and t_1. The next n data points contain the relations that occur in time slices t_1 and t_2. The i-th subset of n data points contain the relations in time slices t_i-1 and t_i. The reshaped data can be used as data input for function stableSpec when computing longitudinal data.

Examples

Run this code
the_data <- longiData4V3T
num_time <- 3
reshaped_the_data <- dataReshape(the_data, num_time)

Run the code above in your browser using DataLab