extractprices: Extract median prices at a given geographical aggregation...

Description Usage Arguments Examples

View source: R/clean.R

Description

Group trade flows by the given geographical aggregation level (region or subregion) and extract the median prices. Prices depend on the quantity unit. For some products quantity unit changes from litre to m3 along the years.

Takes a data frame of tradeflows as input.

Usage

1
2
3
4
5
6
extractprices(dtf, grouping = c("flow", "regionreporter", "year",
  "unit"), lowercoef = 0.5, uppercoef = 2, lowerquantile = 0.25,
  upperquantile = 0.75, includeqestimates = TRUE)

extractpricew(dtf, lowercoef = 1, uppercoef = 1, grouping = c("flow",
  "regionreporter", "year", "unit"))

Arguments

dtf

a dataframe containing all trade flows for one product and their individual prices

grouping

a character vector specifying the grouping variables

lowercoef

numeric multiplier of the first quartile to obtain a lower bound on prices

uppercoef

numeric multiplier of the third quartile to obtain an upper bound on prices

includeqestimates

logical TRUE when comtrade quantity estimates can be included

Examples

1
2
3
4
5
6
7
## Not run: 
# tf a data frame of trade flows
price <-  tf %>% extractprices()
priceglobal <- tf %>%
    extractprices(grouping = c("flow", "year", "unit"))

## End(Not run)

EuropeanForestInstitute/tradeflows documentation built on Oct. 7, 2019, 10:57 a.m.