Convenience function to easily format and concatenate text and numeric values. Can be used with any test and number data. Automatically detects iso_with_units values and incorporates the units into the formatting.

iso_format(
  ...,
  signif = 3,
  format_names = "%s: ",
  format_units = "%s",
  replace_permil = TRUE,
  sep = "\n"
)

Arguments

...

variable names with data. Must have the same dimensions if multiple are supplied. Can be named to rename variable name output. Will include units in output for all iso_with_units.

signif

number of significant digits for numbered data

format_names

how to format the variable names, set to NULL to remove names

format_units

how to format the units from iso_double_with_units variables, set to NULL to omit units

replace_permil

whether to replace the term 'permil' with the permil symbol (\u2030)

sep

separator between variables if multiple are provided in ...

Examples

x <- iso_with_units(1:5, "V")
y <- iso_with_units(1:5, "permil")
iso_format(x, y)
#> [1] "x: 1V\ny: 1‰" "x: 2V\ny: 2‰" "x: 3V\ny: 3‰" "x: 4V\ny: 4‰" "x: 5V\ny: 5‰"
iso_format(amplitude = x, d13C = y)
#> [1] "amplitude: 1V\nd13C: 1‰" "amplitude: 2V\nd13C: 2‰"
#> [3] "amplitude: 3V\nd13C: 3‰" "amplitude: 4V\nd13C: 4‰"
#> [5] "amplitude: 5V\nd13C: 5‰"