Skip to contents

shrthnd_tbl() provides a way to attach annotations to a table. Specifically, it supports three types of annotation: a title, a source note and general notes. The title and source_note are each character vectors of length 1, while notes can be a character vector of any length.

Usage

shrthnd_tbl(tbl, title = NULL, notes = NULL, source_note = NULL)

Arguments

tbl

A tibble::tibble() or object that can be coerced to a tibble.

title

A character vector for the title of tbl

notes

A character vector of general notes relating to tbl

source_note

A character vector for a source note relating to tbl

Value

A tibble with shrthnd annotations

Examples

x <- c("12", "34.567", "[c]", "NA", "56.78[e]", "78.9", "90.123[e]")
sh_x <- shrthnd_num(x, c("[c]", "[e]"))
tbl <- tibble::tibble(x = x, sh_x = sh_x)
shrthnd_tbl(
  tbl,
  title = "Example table",
  notes = c("Note 1", "Note 2"),
  source_note = "Shrthnd documentation, 2023"
)
#> # Title:    Example table
#> # A tibble: 7 × 2
#>   x              sh_x
#>   <chr>      <sh_dbl>
#> 1 12        12.00    
#> 2 34.567    34.57    
#> 3 [c]          NA [c]
#> 4 NA           NA    
#> 5 56.78[e]  56.78 [e]
#> 6 78.9      78.90    
#> 7 90.123[e] 90.12 [e]
#> # ☰ Source: Shrthnd documentation, 2023
#> # ☰ There are 2 notes, use `annotations(x)` to view