Learn R Programming

COINr

Full documentation is available at COINr’s website

COINr is a high-level R package which offers a fully-flexible development and analysis environment for composite indicators and scoreboards. It is inspired by, and broadly follows the methodology of the JRC/OECD Handbook on Composite Indicators and the Competence Centre for Composite Indicators and Scoreboards, which also supported the development of the package (see Acknowledgements).

The main features can be summarised as features for building, features for analysis and features for visualisation and presentation.

Building features:

  • Flexible and fast development of composite indicators with no limits on aggregation levels, numbers of indicators, highly flexible set of methodological choices.
  • Denomination by other indicators
  • Screening units by data requirements
  • Imputation of missing data, by a variety of methods
  • Data treatment using Winsorisation and nonlinear transformations
  • Normalisation (scaling) using a variety of methods
  • Weighting using either manual weighting, PCA weights or correlation-optimised weights.
  • Aggregation of indicators using a variety of methods which can be different for each aggregation level.

Analysis features:

  • Detailed indicator statistics, and data availability within aggregation groups
  • Multivariate analysis, including quick functions for PCA, and a detailed correlation analysis and visualisation
  • Easy “what if” analysis - very quickly checking the effects of adding and removing indicators, changing weights, methodological variations
  • Full global uncertainty and sensitivity analysis which can check the impacts of uncertainties in weighting and many methodological choices

Visualisation and presentation:

  • Statistical plots of indicators - histograms, violin plots, dot plots, scatter plots and more
  • Bar charts, stacked bar charts and tables for presenting indicator data and making comparisons between units
  • Correlation plots for visualising correlations between indicators and between aggregation levels

COINr also allows fast import from the COIN Tool and fast export to Excel.

Installation

COINr is on CRAN and can be installed by running:

# Install released version from CRAN
install.packages("COINr")

The development version, which may be slightly more up-to-date, can be installed from GitHub:

# Install development version from GitHub
devtools::install_github("bluefoxr/COINr")

This should directly install the package from Github, without any other steps. You may be asked to update packages. This might not be strictly necessary, so you can also try skipping this step.

Getting started

COINr needs a little reading and learning to understand properly. But once you have done that, it can be very powerful for developing composite indicators.

A good place to get started is COINr’s “Overview” vignette. Try vignette("overview").

The most thorough documentation is available at COINr’s website (developed using pkgdown). This contains all package documentation in an easy-to-navigate format. All documentation available here is also available by browsing COINr vignettes: see vignette(package = "COINr").

Tutorials

COINr was presented at the European Commission’s training week on composite indicators and scoreboards in September 2023, including a short one hour tutorial:

  • See the presentation video here (COINr presentation starts around 16:28 but if you are new to composite indicators it is well worth following the full training)
  • See the tutorial document here and the code in the GitHub repo here.

Recent updates

COINr has been recently updated to v1.0, skipping a few version numbers. This has brought in many new features, some discarded features, less dependencies and more robust underlying code. The syntax has also been changed to make the package more consistent. See vignette("v1") to learn about these changes if you were using COINr prior to v1.0.

COINr documentation was previously contained in an online book. This is still available, and although the principles of composite indicators there are still all valid, the code refers strictly to COINr < v.1.0.

If you prefer to roll back to the old COINr, you can still install it as a separate package called “COINr6”. This is available on GitHub:

remotes::install_github("bluefoxr/COINr6")

Help and issues

For general help with COINr, the best place to look is the package’s documentation which is available either via the command line (vignette(package = "COINr")) or by checking individual function documentation (?function_name). All documentation is also conveniently available online at COINr’s website.

If you find any problems with the package, including bugs or suggestions, either open a GitHub issue here, or else contact me by email.

Finally, contributions to the package are most welcome. This should be done by cloning the repo, making your modifications, and then opening a pull request. You could also contact me in advance to discuss changes and extensions. Any changes (especially new functions) should be accompanied by unit tests, and all existing tests should run without errors or warnings. To do this, run:

devtools::test()

Citing COINr

If you have found COINr helpful, we are grateful if you cite the package. COINr is citable by a paper in the Journal of Open Source Software which you can find here (with citation information).

In R you can also generate the citation info using citation(package = "COINr"), or see the same info on the COINr web page.

Acknowledgements

COINr was initially developed under contract for the European Commission’s Joint Research Centre until 2021, and this enabled the bulk of the initial development, as well as many helpful discussions with colleagues from the Competence Centre for Composite Indicators and Scoreboards, and this is gratefully acknowledged. Since then, the package has been continuously modified and improved while working on other projects and following user feedback.

Copy Link

Version

Install

install.packages('COINr')

Monthly Downloads

443

Version

1.1.14

License

MIT + file LICENSE

Maintainer

William Becker

Last Published

May 21st, 2024

Functions in COINr (1.1.14)

Custom

Custom operation
Impute

Imputation of missing data
Denominate.coin

Denominate data set in a coin
Normalise.purse

Create normalised data sets in a purse of coins
Denominate.data.frame

Denominate data sets by other variables
Impute.numeric

Impute a numeric vector
Impute.purse

Impute data sets in a purse
Custom.coin

Custom operation
Normalise

Normalise data
Impute.coin

Impute a data set in a coin
Impute.data.frame

Impute a data frame
Normalise.coin

Create a normalised data set
Regen.coin

Regenerate a coin
Regen.purse

Regenerate a purse
Normalise.data.frame

Normalise a data frame
Regen

Regenerate a coin or purse
Normalise.numeric

Normalise a numeric vector
Treat.coin

Treat a data set in a coin for outliers
Treat

Treat outliers
a_copeland

Copeland scores
a_amean

Weighted arithmetic mean
SA_sample

Generate sample for sensitivity analysis
SA_estimate

Estimate sensitivity indices
Treat.purse

Treat a purse of coins for outliers
WorldDenoms

World denomination data
Treat.numeric

Treat a numeric vector for outliers
Treat.data.frame

Treat a data frame for outliers
a_genmean

Weighted generalised mean
a_gmean

Weighted geometric mean
build_example_coin

Build ASEM example coin
Screen.coin

Screen units based on data availability
check_iData

Check iData
check_SkewKurt

Check skew and kurtosis of a vector
Screen

Screen units based on data availability
boxcox

Box Cox transformation
build_example_purse

Build example purse
export_to_excel

Export a coin or purse to Excel
compare_df

Compare two data frames
change_ind

Add and remove indicators
get_corr_flags

Find highly-correlated indicators within groups
Denominate

Denominate data
Screen.data.frame

Screen units based on data availability
Screen.purse

Screen units based on data availability
compare_coins_corr

Compare two coins by correlation
get_data_avail.coin

Get data availability of units
get_denom_corr

Correlations between indicators and denominators
get_cronbach

Cronbach's alpha
get_dset

Gets a named data set and performs checks
compare_coins_multi

Compare multiple coins
get_data.coin

Get subsets of indicator data
get_PCA

Perform PCA on a coin
get_trends

Get time trends
get_data_avail.data.frame

Get data availability of units
i_mean

Impute by mean
get_sensitivity

Sensitivity and uncertainty analysis of a coin
get_data

Get subsets of indicator data
i_mean_grp

Impute by group mean
get_results

Results summary tables
get_unit_summary

Generate unit summary table
i_median

Impute by median
get_eff_weights

Get effective weights
n_minmax

Minmax a vector
get_corr

Get correlations
i_median_grp

Impute by group median
log_CT_orig

Log-transform a vector
n_fracmax

Normalise as fraction of max value
approx_df

Interpolate time-indexed data frame
get_noisy_weights

Noisy replications of weights
log_CT

Log-transform a vector
a_hmean

Weighted harmonic mean
check_iMeta

Check iMeta
export_to_excel.coin

Export a coin to Excel
export_to_excel.purse

Export a purse to Excel
get_dset.coin

Gets a named data set and performs checks
n_borda

Normalise using Borda scores
get_stats

Statistics of columns/indicators
impute_panel

Impute panel data
is.coin

Check if object is coin class
get_stats.coin

Statistics of indicators
n_prank

Normalise using percentile ranks
qNormalise

Quick normalisation
print.purse

Print purse
compare_coins

Compare two coins
n_zscore

Z-score a vector
n_dist2max

Normalise as distance to maximum value
plot_dist

Static indicator distribution plots
plot_dot

Dot plots of single indicator with highlighting
n_goalposts

Normalise using goalpost method
names_to_codes

Generate short codes from long names
qNormalise.coin

Quick normalisation of a coin
n_dist2ref

Normalise as distance to reference value
remove_elements

Check the effect of removing indicators or aggregates
get_dset.purse

Gets a named data set and performs checks
signif_df

Round a data frame to specified significant figures
round_df

Round down a data frame
skew

Calculate skewness
qNormalise.data.frame

Quick normalisation of a data frame
qNormalise.purse

Quick normalisation of a purse
qTreat

Quick outlier treatment
replace_df

Replace multiple values in a data frame
import_coin_tool

Import data directly from COIN Tool
icodes_to_inames

Convert iCodes to iNames
get_str_weak

Generate strengths and weaknesses for a specified unit
get_stats.data.frame

Statistics of columns
ucodes_to_unames

Convert uCodes to uNames
get_data_avail

Get data availability of units
n_dist2targ

Normalise as distance to target
n_scaled

Scale a vector
get_data.purse

Get subsets of indicator data
prc_change

Percentage change of time series
qTreat.coin

Quick outlier treatment of a coin
print.coin

Print coin
n_rank

Normalise using ranks
winsorise

Winsorise a vector
log_CT_plus

Log transform a vector (skew corrected)
get_opt_weights

Weight optimisation
log_GII

Log-transform a vector
plot_corr

Static heatmaps of correlation matrices
plot_bar

Bar chart
plot_framework

Framework plots
get_pvals

P-values for correlations in a data frame or matrix
is.purse

Check if object is purse class
kurt

Calculate kurtosis
plot_sensitivity

Plot sensitivity indices
outrankMatrix

Outranking matrix
new_coin

Create a new coin
qTreat.data.frame

Quick outlier treatment of a data frame
plot_uncertainty

Plot ranks from an uncertainty/sensitivity analysis
plot_scatter

Scatter plot of two variables
rank_df

Convert a data frame to ranks
qTreat.purse

Quick outlier treatment of a purse
ASEM_COIN

ASEM COIN (COINr < v1.0)
Aggregate.purse

Aggregate indicators
Aggregate.coin

Aggregate indicators in a coin
COIN_to_coin

Convert a COIN to a coin
Aggregate

Aggregate data
Aggregate.data.frame

Aggregate data frame
CAGR

Compound annual growth rate
ASEM_iMeta

ASEM indicator metadata
ASEM_iData

ASEM raw indicator data
ASEM_iData_p

ASEM raw panel data
Denominate.purse

Denominate a data set within a purse.
Custom.purse

Custom operation