TimeExpand {DataCombine} | R Documentation |
Expands a data set so that it includes an observation for each time point in a sequence. Works with grouped data.
Description
Expands a data set so that it includes an observation for each time point in a sequence. Works with grouped data.
Usage
TimeExpand(data, GroupVar, TimeVar, begin, end, by = 1)
Arguments
data |
a data frame. |
GroupVar |
the variable in |
TimeVar |
the variable in |
begin |
numeric of length 1. Specifies beginning time point.
Only relevant if |
end |
numeric of length 1. Specifies ending time point.
Only relevant if |
by |
numeric or character string specifying the steps in the
|
Examples
Data <- data.frame(country = c("Cambodia", "Camnodia", "Japan", "Japan"),
year = c(1990, 2001, 1994, 2012))
ExpandedData <- TimeExpand(Data, GroupVar = 'country', TimeVar = 'year')
[Package DataCombine version 0.2.21 Index]