Description Usage Arguments Details Value See Also Examples
View source: R/coin_denominate.R
Denominates (divides) indicators by other "denominator" indicators that are either input here or were attached as "Den_*"
columns of
IndData
when assembling the COIN. This function can work either on COINs or on data frames.
1 2 3 4 5 6 7 8 9 
obj 
COIN object or a data frame of indicator data to be denominated. If a data frame, must include a 
dset 
The data set to denominate (only if COIN used as input) 
specby 
Selects the source of the specifications for denomination.

denomby 
Character vector specifying which denominators to use for each indicator. Only used if

scaledenoms 
This allows the possibility to scale denominators if needed. For example, if GDP is a denominator and is measured in
dollars, dividing will create very small numbers (order 1e10 and smaller) which could cause problems with numerical precision. This should be
a named list of the form e.g. 
denominators 
A data frame of denominator data. Columns should be denominator data, with column names corresponding
to entries in 
out2 
Where to output the results. If 
Typically, the aim here is to convert extensive (sizerelated) variables into intensive variables(comparable between units
of different sizes). There is also the option scaledenoms
to scale denominators to avoid very small or very large numbers resulting.
This function expects that denominators$UnitCode
contains all unit codes found in the data frame to be denominated. Unused
unit codes (rows) in denominators
will be ignored. Note that some nationallevel denominator data is available inside COINr at COINr::WorldDenoms
.
See online documentation for further details and examples.
If out2 = COIN
and obj
is a COIN, returns an updated COIN object, with new dataset .$Data$Denominated
of denominated indicators.
Otherwise returns a data frame of denominated indicator data.
WorldDenoms A data set of some common nationallevel denominators.
1 2 3 4 5 6 7 8 9 10 11 12  # assemble ASEM COIN
ASEM < assemble(IndData = ASEMIndData, IndMeta = ASEMIndMeta, AggMeta = ASEMAggMeta)
# denominate using specs present on assembly
ASEM < denominate(ASEM, dset = "Raw")
# OR, use function on data frame
# Get a sample of indicator data (note must be indicators plus a "UnitCode" column)
IndData < ASEMIndData[c("UnitCode", "Goods", "Services", "FDI")]
# Also get some denominator data
Denoms < ASEMIndData[c("UnitCode", "Den_Pop", "Den_GDP")]
# Denominate one by the other
IndDataDenom < denominate(IndData, denomby = c("Den_GDP", NA, "Den_Pop"), denominators = Denoms)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.