Skip to contents

Convert formatting information into arguments that can be used by gt.

Usage

translate_defs(format_long)

Arguments

format_long

Data frame produced by get_formatting containing raw formatting information.

Value

A data frame with formatting information compatible with gt.

Examples

example_spreadsheet <- system.file("extdata/rodentsheet.xlsx", package = "forgts")
format_long <- get_formatting(example_spreadsheet)
translate_defs(format_long)
#> # A tibble: 455 × 9
#>    rowid target_var       format  val   styling_arg helper arg_value border_side
#>    <chr> <chr>            <chr>   <chr> <chr>       <chr>  <chr>     <chr>      
#>  1 1     measurement type bold    FALSE weight      cell_… NA        NA         
#>  2 1     measurement type italic  TRUE  style       cell_… italic    NA         
#>  3 1     measurement type underl… NA    decorate    cell_… NA        NA         
#>  4 1     measurement type hl_col… NA    color       cell_… NA        NA         
#>  5 1     measurement type strike… FALSE decorate    cell_… NA        NA         
#>  6 1     measurement type text_c… NA    color       cell_… NA        NA         
#>  7 1     measurement type border… NA    top         cell_… NA        NA         
#>  8 1     measurement type border… NA    color       cell_… NA        NA         
#>  9 1     measurement type border… NA    right       cell_… NA        NA         
#> 10 1     measurement type border… NA    color       cell_… NA        NA         
#> # ℹ 445 more rows
#> # ℹ 1 more variable: border_property <chr>