View source: R/define_meta_data.R
table_info | R Documentation |
Takes descriptive information about a table and returns a tidy data.table.
table_info(
table_name,
source_identifier,
identifier_columns,
key_outcome_specs
)
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. |
A tidy data.table with the table's metadata. The identifier_columns
and
grouping_variables
columns are list-columns.
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)])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.