filter_sube() applies configurable exclusions and bounds to tidy SUBE
outputs.
Usage
filter_sube(
data,
country_exclusions = character(),
year_exclusions = NULL,
product_exclusions = character(),
bounds = list(multiplier = list(GO = c(1, 4), VA = c(0, 1), EMP = c(0, Inf), CO2 = c(0,
Inf)), elasticity = list(default = c(0, Inf))),
drop_negative_elasticities = TRUE
)
plot_sube(
data,
by = c("country", "product"),
kind = c("boxplot", "density"),
measure = NULL,
variable = NULL
)
write_sube(path, data, format = c("csv", "rds", "dta"))Arguments
- data
Tidy SUBE data. Expected columns are
COUNTRY,CPAagg,variable,measure,type, andvalue.YEARis optional.- country_exclusions
Countries to drop.
- year_exclusions
Years to drop.
- product_exclusions
Product codes to drop.
- bounds
Named list of lower and upper bounds by measure and variable.
- drop_negative_elasticities
Whether to remove negative elasticities.
- by
Orientation for boxplots.
- kind
Plot type.
- measure
Optional measure filter.
- variable
Optional variable filter.
- path
Output path. For lists, a directory will be created if needed.
- format
Output format.
Value
filter_sube() returns a filtered data.table. plot_sube()
returns a ggplot object. write_sube() returns the normalized output
path invisibly.
Details
plot_sube() generates boxplots or densities from tidy SUBE outputs.
write_sube() writes a data.frame, data.table, or named list of tables
to CSV, RDS, or DTA files.