Skip to contents

Round all numeric values in an input–output style table to a specified number of digits. The key column (first column) is preserved unchanged.

Usage

matrix_round(data_table, digits = 0)

Arguments

data_table

A symmetric input–output table, use table, supply table, tax table, or margins table.

digits

Integer number of decimal places to round to. Defaults to 0.

Value

A data.frame (or tibble) with the key column intact and all other numeric columns rounded to the given precision.

Details

This is useful for comparing results across software or publications that present rounded tables.

Examples

de_coeff <- input_coefficient_matrix_create(iotable_get())
head(matrix_round(de_coeff, digits = 2))
#>              iotables_row agriculture_group industry_group construction
#> 1       agriculture_group              0.03           0.02         0.00
#> 2          industry_group              0.18           0.28         0.26
#> 3            construction              0.01           0.01         0.02
#> 4             trade_group              0.08           0.07         0.06
#> 5 business_services_group              0.08           0.09         0.13
#> 6    other_services_group              0.04           0.01         0.01
#>   trade_group business_services_group other_services_group
#> 1        0.00                    0.00                 0.00
#> 2        0.08                    0.02                 0.06
#> 3        0.01                    0.03                 0.02
#> 4        0.14                    0.02                 0.04
#> 5        0.12                    0.28                 0.07
#> 6        0.02                    0.02                 0.04