Description Usage Arguments Details Value See Also Examples
Function to specify the panel data properties of a data frame. The syntax is provided in the 'Details'. Intended for country-year cross-sectional time series (CSTS) data, but should fit any panel data format.
1 2 3 4 5 6 |
dataset |
the panel data frame to set the attributes to. |
data |
the |
spec |
the |
type |
the type of observations in the panel data.
Defaults to |
name |
a description of the dataset. |
url |
a URI locator for the dataset (the website address). |
quiet |
whether to return some details. Defaults to
|
an xtdata
attribute is a list of 5 to 11 panel
data paramaters stored as character strings in the
following named vectors:
data, a vector of variable names coding for the unique identifier and time period, optionally followed by the variable names for the short and long observation names, as with alphabetical country codes and country names.
spec, a vector of variable formats that match the
data
variables; this allows to store
countrycode
formats in the
dataset and can theoretically work with any other format,
like FIPS or households.
type, a vector
that defines the type of observations contained in the
data; "country"
is the only type that currently
produces any specific behaviour from xtdata
through the countrycode
package, but "region"
is on the way for working
with NUTS codes, and it should be feasable to implement
FIPS codes.
name, an optional vector that defines the dataset name, which is printed on top of the function results.
url, an optional vector that defines the URI locator for the data source (typically, the website address where to find codebooks, technical documentation and related publications).
These characteristics mimic some of the behaviour of the
xtset
and label data
commands in Stata.
a data frame with the xtdata
attribute.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Load QOG demo datasets.
data(qog.demo)
# Set xtdata attribute on QOG time series.
QOG = xtset(qog.ts.demo)
# Set xtdata attribute on recent years.
QOG.200x = xtset(subset(qog.ts.demo, year > 1999))
# Manually set xtdata attribute for UDS dataset.
UDS = get_uds()
UDS = xtset(UDS,
data = c("ccodecow", "year"),
spec = c("cown", "year"),
type = "country",
name = "Unified Democracy Scores"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.