coverage: Coverage - Unit and Time

Description Usage Arguments Examples

View source: R/coverage.R

Description

The coverage package and associated function provides you with a visual, data frame or latex table summary of your time and unit coverage.

Usage

1
2
3
coverage(fit, timevar = "year", unitvar = "country", data,
  variable.names, special.NA, output = c("visual", "data.frame",
  "latex.table")[1], data.frequency = 1, ...)

Arguments

fit

A fitted object.

timevar

Time variable. Defaults to "year".

unitvar

Unit variable. Defaults to "country".

data

Data to be investigated. If none is supplied, attempts to use same data as "fit", first by considering its model matrix, and - if variables are missing (such as timevar and unitvar) - by looking for the source data in the global environment. (Optional)

variable.names

Variables to be checked for coverage. If none is supplied, defaults to variables used in fit, or if fit not provided, all variables in data. (Optional)

special.NA

Variable that if missing will indicate "special" missingness. Can be used to distinguish observations with missing data from time-unit combinations which did not exist or were not considered. (Optional)

output

Desired extra output: "visual" (default), "data.frame", or "latex.table". First depends on ggplot2, last stargazer, both available on CRAN.

data.frequency

Integer specifying the increments between observations. Defaults to 1.

...

Additional arguments passed to ggplot2's theme function, or stargazer, depending on output selected. (Optional)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
library(WDI)
wdi.sample <- WDI(indicator=c("GDPPC" = "NY.GDP.PCAP.KD",
                             "services_gdp" = "BG.GSR.NFSV.GD.ZS",
                             "agriculture_gdp" = "NV.AGR.TOTL.ZS",
                             "telephones" = "IT.TEL.TOTL.P3"),
                             start=1970, end=2012,
                             country="all")

lm.fit <- lm(GDPPC ~ ., data = wdi.sample)

coverage(lm.fit)

# One may also specify variables explicitly:
coverage(timevar = "year",
         unitvar = "country",
         variable.names = c("GDPPC",
                  "services_gdp",
                  "agriculture_gdp",
                  "telephones"),
         data = wdi.sample)

# Or request data.frame or latex.table output:

# For data.frame, use:
coverage(fit = lm.fit, output = "data.frame")

# For latex table, use:
coverage(fit = lm.fit, output = "latex.table")

sondreus/coverage documentation built on May 30, 2019, 6:27 a.m.