table_info: Define Metadata for a Data Table in a Tidy data.table

View source: R/define_meta_data.R

table_infoR Documentation

Define Metadata for a Data Table in a Tidy data.table

Description

Takes descriptive information about a table and returns a tidy data.table.

Usage

table_info(
  table_name,
  source_identifier,
  identifier_columns,
  key_outcome_specs
)

Arguments

table_name

Character string, the conceptual name of the table.

source_identifier

Character string, the file name or DB table identifier.

identifier_columns

Character vector, names of column(s) acting as primary key(s).

key_outcome_specs

A list of 'OutcomeSpec' lists.

Value

A tidy data.table with the table's metadata. The identifier_columns and grouping_variables columns are list-columns.

Examples

transactions_info <- table_info(
  table_name = "transactions",
  source_identifier = "transactions.csv",
  identifier_columns = c("customer_id", "product_id", "time"),
  key_outcome_specs = list(
    list(
      OutcomeName = "Revenue",
      ValueExpression = quote(price * quantity),
      AggregationMethods = list(
        list(AggregatedName = "RevenueByCustomer", AggregationFunction = "sum",
             GroupingVariables = "customer_id"),
        list(AggregatedName = "RevenueByProduct", AggregationFunction = "sum",
             GroupingVariables = "product_id")
      )
    )
  )
)
# Note the structure of the list-columns
print(transactions_info)
str(transactions_info[, .(identifier_columns, grouping_variable)])


DBmaps documentation built on Sept. 9, 2025, 5:44 p.m.