tag_table {tatoo}R Documentation

Tag Tables

Description

Add metadata/captioning (like table_id, title, footer) to a Tatoo_table or data.frame. This metadata will be used by print() methods and export functions such as as_workbook() or save_xlsx().

Usage

tag_table(dat, meta)

Arguments

dat

A Tatto_table object or anything that can be coerced to a data.table.

meta

a tt_meta object. Metadata can also be set and modified using setters (see meta())

Value

a Tagged_table: a Tatoo_table with an additional meta attribute

See Also

Attribute setters: meta<-()

Tagged Table Metadata: tt_meta()

Other Tatoo tables: comp_table(), mash_table(), stack_table(), tatoo_table()

Examples


dat <- data.frame(
  name  = c("hans", "franz", "dolores"),
  grade = c(1, 3, 2)
)

table_metadata <- tt_meta(
  table_id = "Tab1",
  title = "Grades",
  longtitle = "grades of the final examination"
)

# Metadata can be assign in a formal way or via set functions
dat <- tag_table(dat,  meta = table_metadata)
meta(dat) <- table_metadata

# Table metadata is stored as an attribute, and cann be acces thus. It can
# also be modified via convenient set functions
attr(dat, 'meta')$title
meta(dat)$title
longtitle(dat) <- "Grades of the final examination"

# [1] "Grades"

print(dat)

# Tab1: Grades - Grades of the final examination
#
# name grade
# 1:    hans     1
# 2:   franz     3
# 3: dolores     2


[Package tatoo version 1.1.2 Index]