Learn R Programming

iotables (version 0.9.4)

round_table: Systematically round numeric values in a table

Description

Utility function to round all numeric columns in an input-output style table. It is mainly intended for reproducibility and comparability with external sources that report rounded values. Non-numeric columns are left unchanged.

Special cases:

  • If digits = NULL (default), the function returns the input unchanged (no rounding).

  • Values exactly equal to 1e-06 are preserved to avoid suppressing small "epsilon" entries that occur in published IOTs and SUTs.

Usage

round_table(data_table, digits = NULL)

Value

A tibble (if input was a tibble) or data frame with numeric columns rounded according to digits. Non-numeric columns are unchanged. If digits = NULL or invalid, the table is returned unchanged.

Arguments

data_table

A symmetric input–output table, a use table, a supply table, or a margins/taxes table. Must be a data frame or tibble.

digits

Integer scalar giving the number of digits for rounding. If NULL, no rounding is performed. If not numeric, a warning is issued and the table is returned unchanged.

Details

Rounding conventions in published tables differ across sources:

  • Eurostat (2008, Manual of Supply, Use and Input-Output Tables), presents benchmark IOTs rounded to integers (millions of EUR).

  • UN (2018, Handbook on SUTs and IOTs), notes that examples may not sum exactly because of rounding (p. 15).

This function allows the user to replicate such rounded presentations while keeping analytic pipelines consistent. Internally, rounding should be used with care: repeated rounding in intermediate steps may accumulate error. For modelling, keep digits = NULL and apply rounding only when reproducing published sources.