listFromLong {MSCMT} | R Documentation |
Convert Long Format to List Format
Description
listFromLong
converts long to list format.
Usage
listFromLong(
foo,
unit.variable,
time.variable,
unit.names.variable = NULL,
exclude.columns = NULL
)
Arguments
foo |
A |
unit.variable |
Either a numeric scalar with the column number (in
|
time.variable |
Either a numeric scalar with the column number (in
|
unit.names.variable |
Optional. If not |
exclude.columns |
Optional (defaults to |
Details
listFromLong
is a convenience function to convert long format
(in a data.frame
, as used by package 'Synth') to list
format, where data is stored as a list of matrices.
Most parameter names are named after their equivalents in the
dataprep
function of package 'Synth'.
Value
A list of matrices with rows corresponding to the times and columns
corresponding to the unit (or unit names, respectively) for all columns of
foo
which are neither excluded nor have a special role as time, unit,
or unit names variable.
Examples
if (require("Synth")) {
data(basque)
Basque <- listFromLong(basque, unit.variable="regionno",
time.variable="year",
unit.names.variable="regionname")
names(Basque)
head(Basque$gdpcap)
}