Valid COICOP codes can be flagged by is.coicop().
The function level() returns their level (e.g. 2-digit division or 5-digit subclass level).
For HICP data, special aggregates like food or energy have their own codes, which can be flagged by is.spec.agg().
The function spec.agg() provides the composition of special aggregates.
The function label() translates the codes into their descriptions.
# flag COICOP, bundle and special aggregate codes:
is.coicop(id, settings=list())
is.bundle(id, settings=list())
is.spec.agg(id, settings=list())# derive the level of COICOP codes:
level(id, settings=list())
# label codes:
label(id, settings=list())
# get the composition of a special aggregate:
spec.agg(id=NULL, settings=list())
The functions is.coicop(), is.bundle() and is.spec.agg() return a logical vector, the function level() an integer vector and the function label() a character vector.
All function outputs have the same length as id.
The function spec.agg() returns a named list with the special aggregate composition.
Sebastian Weinand
character vector of COICOP or special aggregate codes.
list of control settings to be used. The following settings are supported:
coicop.version : character specifying the COICOP version to be used.
See details for the allowed values.
The default is getOption("hicp.coicop.version").
coicop.prefix : character specifying a prefix for the COICOP codes.
The default is getOption("hicp.coicop.prefix").
all.items.code : character specifying the code internally used for the all-items index.
The default is taken from getOption("hicp.all.items.code").
If the character is named, the function label() uses the name as the label of the all-items code.
The following COICOP versions are supported:
Classification of Individual Consumption According to Purpose (COICOP-1999): coicop1999
European COICOP (version 1, ECOICOP): ecoicop1
ECOICOP adapted to the needs of the HICP (version 1, ECOICOP-HICP): ecoicop1.hicp
COICOP-2018 (including the voluntary 6-digit codes): coicop2018
ECOICOP (version 2, ECOICOP 2): ecoicop2
ECOICOP adapted to the needs of the HICP (version 2, ECOICOP 2 HICP): ecoicop2.hicp
The COICOP version can be set temporarily in the function settings or globally via options("hicp.coicop.version").
For ecoicop1.hicp, some COICOP codes are merged into bundles (e.g. 08X, 0531_2), deviating from the expected code structure.
Although such bundle codes are no valid COICOP codes, they are internally resolved into their underlying codes and processed in that way if they can be found in the package's internal bundle code dictionary.
None of the COICOP versions include a code for the all-items index.
The internal package code for the all-items index is defined by options("hicp.all.items.code").
Its level is always 1 and the label All-items by default.
For HICP data from Eurostat's database, COICOP codes are usually prefixed by ``CP''.
Whether such a prefix is expected can be defined in options("hicp.coicop.prefix").
European Commission, Eurostat, Harmonised Index of Consumer Prices (HICP) - Methodological Manual - 2024 edition, Publications Office of the European Union, 2024, Annex 11.1, tools:::Rd_expr_doi("10.2785/055028").
child, parent, tree
# example codes:
ids <- c("TOTAL","CP01","CP011","CP99","FOOD","NRG")
ids[is.coicop(ids)] # all-items is no valid COICOP code
ids[is.spec.agg(ids)]
level(ids) # special aggregates without level
label(ids)
Run the code above in your browser using DataLab