listFromLong | R Documentation |
listFromLong
converts long to list format.
listFromLong(
foo,
unit.variable,
time.variable,
unit.names.variable = NULL,
exclude.columns = NULL
)
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 |
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'.
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.
## Not run:
## example has been modified because package 'Synth' has been archived
## dataset 'basque' is now retrieved from archive
setwd(tempdir())
download.file("https://cran.r-project.org/src/contrib/Archive/Synth/Synth_1.1-6.tar.gz",
destfile="Synth.tar.gz")
untar("Synth.tar.gz",files="Synth/data/basque.RData")
load("Synth/data/basque.RData")
Basque <- listFromLong(basque, unit.variable="regionno",
time.variable="year",
unit.names.variable="regionname")
names(Basque)
head(Basque$gdpcap)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.