Turns cell formatting into annotations for values in the target row.

annotate_mf(xlfilepath, orig, new)

Arguments

xlfilepath

Path to a single-sheet spreadsheet file (xls or xlsx).

orig

Variable to annotate formatting in.

new

Name of new variable with cell formatting pasted as a string.

Value

A tibble with a new column with meaningful formatting embedded as text.

Details

At this point, seven popular approaches for meaningful formatting (bold, colored text, italic, strikethrough, underline, double underline, and cell highlighting) are hardcoded in the function. sheets, skip, and range arguments for spreadsheet input are not supported. The hex8 code of the fill color used for text color and cell highlighting is also appended in the output. Ensure the data in the spreadsheet are rectangular before running.

Examples

example_spreadsheet <- system.file("extdata/dog_test.xlsx", package = "unheadr") annotate_mf(example_spreadsheet, orig = Task, new = Task_annotated)
#> # A tibble: 11 x 3 #> Task Task_annotated Score #> <chr> <chr> <dbl> #> 1 Outdoor activities (bold, highlight-FFFFF200) Outdoor acti… 7.67 #> 2 Walks on a loose leash withou… Walks on a loose leash without pulling 7 #> 3 Walks without chasing bicycle… Walks without chasing bicycles, animals… 6 #> 4 Greets friends and strangers … Greets friends and strangers without ju… 10 #> 5 Home behavior (bold, highlight-FFFFF200) Home behavior 8.5 #> 6 Moves location when directed … Moves location when directed without gr… 9 #> 7 Does not rush through doorways Does not rush through doorways 8 #> 8 General social skills and obe… (bold, highlight-FFFFF200) General soci… 7 #> 9 Can play or interact appropri… Can play or interact appropriately with… 7 #> 10 Can be groomed or handled wit… Can be groomed or handled without squir… 8 #> 11 Stops barking on command Stops barking on command 6