xtset: Set panel data properties

Description Usage Arguments Details Value See Also Examples

Description

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.

Usage

1
2
3
4
5
6
  xtset(dataset = NULL,
    data = c("ccode", "year", "ccodealp", "cname"),
    spec = c("iso3n", "year", "iso3c", "country.name"),
    type = "country",
    name = "Quality of Government, time series data",
    url = "http://www.qog.pol.gu.se/", quiet = FALSE)

Arguments

dataset

the panel data frame to set the attributes to.

data

the data parameters to pass to the data: unique identifier and time period, optionally followed by short and long observation names. Defaults to QOG country-year data settings. See 'Details'.

spec

the spec parameters to pass to the data: formats of unique identifier and time period, optionally followed by formats of short and long observation names. Defaults to QOG country-year data settings. See 'Details'.

type

the type of observations in the panel data. Defaults to "country", which will read the spec parameters as countrycode formats.

name

a description of the dataset.

url

a URI locator for the dataset (the website address).

quiet

whether to return some details. Defaults to FALSE (verbose).

Details

an xtdata attribute is a list of 5 to 11 panel data paramaters stored as character strings in the following named vectors:

These characteristics mimic some of the behaviour of the xtset and label data commands in Stata.

Value

a data frame with the xtdata attribute.

See Also

countrycode

Examples

 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"
    )

briatte/qogdata documentation built on May 13, 2019, 7:43 a.m.