append_metadata: Append the Tplyr table metadata dataframe

append_metadataR Documentation

Append the Tplyr table metadata dataframe

Description

append_metadata() allows a user to extend the Tplyr metadata data frame with user provided data. In some tables, Tplyr may be able to provided most of the data, but a user may have to extend the table with other summaries, statistics, etc. This function allows the user to extend the tplyr_table's metadata with their own metadata content using custom data frames created using the tplyr_meta object.

Usage

append_metadata(t, meta)

Arguments

t

A tplyr_table object

meta

A dataframe fitting the specifications of the details section of this function

Details

As this is an advanced feature of Tplyr, ownership is on the user to make sure the metadata data frame is assembled properly. The only restrictions applied by append_metadata() are that meta must have a column named row_id, and the values in row_id cannot be duplicates of any row_id value already present in the Tplyr metadata dataframe. tplyr_meta() objects align with constructed dataframes using the row_id and output dataset column name. As such, tplyr_meta() objects should be inserted into a data frame using a list column.

Value

A tplyr_table object

Examples

t <- tplyr_table(mtcars, gear) %>%
  add_layer(
    group_desc(wt)
  )

t %>%
  build(metadata=TRUE)

m <- tibble::tibble(
  row_id = c('x1_1'),
  var1_3 = list(tplyr_meta(rlang::quos(a, b, c), rlang::quos(a==1, b==2, c==3)))
)

append_metadata(t, m)

Tplyr documentation built on May 29, 2024, 10:37 a.m.