This function is intended for data frames /tibbles only and tries to figure out which numeric columns have units in the column names and makes those units implicit using iso_double_with_units. The reverse function is iso_make_units_explicit.

iso_make_units_implicit(df, prefix = " [", suffix = "]")

Arguments

df

the data frame in which to make the units implicit/explicit

prefix

the prefix for the units

suffix

the suffix for the units

See also

Examples

# generate implicit units
df <- tibble(peak = 1:5, `height [V]` = 1:5)
iso_make_units_implicit(df)
#> # A tibble: 5 × 2
#>    peak   height
#>   <int> <dbl[V]>
#> 1     1        1
#> 2     2        2
#> 3     3        3
#> 4     4        4
#> 5     5        5

# convert back and forth
iso_make_units_implicit(df) |> iso_make_units_explicit()
#> # A tibble: 5 × 2
#>    peak `height [V]`
#>   <int>        <dbl>
#> 1     1            1
#> 2     2            2
#> 3     3            3
#> 4     4            4
#> 5     5            5

# implicit units from custom prefix & suffix
df <- tibble(peak = 1:5, height.V = 1:5)
iso_make_units_implicit(df, prefix = ".", suffix = "")
#> # A tibble: 5 × 2
#>    peak   height
#>   <int> <dbl[V]>
#> 1     1        1
#> 2     2        2
#> 3     3        3
#> 4     4        4
#> 5     5        5