add_logit_tables_xml_generate_levels: Add a table to convert to XML but generate additional levels...

View source: R/xml.R

add_logit_tables_xml_generate_levelsR Documentation

Add a table to convert to XML but generate additional levels of XML nesting providing a special case for logit tables.

Description

This is basically a combination of add_xml_data_generate_levels and add_logit_tables_xml check the documentation for each to understand the individual behaviors.

Usage

add_logit_tables_xml_generate_levels(
  dot,
  data,
  header,
  old_tag,
  new_tag,
  num_levels,
  rename_final,
  column_name = old_tag,
  column_order_lookup = header,
  base_logit_header = header
)

Arguments

dot

The current state of the pipeline started from create_xml

data

The tibble of data to add to the conversion

header

The base header tag to can be looked up in the header file to convert data besides the additional levels of nesting.

old_tag

The XML tag which is being expanded to add more levels

new_tag

The XML tag which will serve as the additional levels

num_levels

The number of additional levels to generate

rename_final

Whether to rename the final old_tag to new_tag in the original header

column_name

The base name of the column in data which will get expanded by appending paste0(column_name, (seq_len(num_levels) - 1))

column_order_lookup

A tag that can be used to look up LEVEL2_DATA_NAMES to reorder the columns of data before XML conversion to ensure they correspond with the ModelInterface header. Note by default the header is used then we append the additional columns generated by column_name + num_levels. If given NULL no column reordering will be done.

base_logit_header

The base header tag to use for the generated logit type tables such that paste(base_logit_header, logit.type, sep = "_") corresponds to the appropriate model interface header. Note by default this value is the same as header as often this is the case but certainly not always.

Value

A "data structure" to hold the various parts needed to run the model interface CSV to XML conversion.

Author(s)

Pralit Patel


JGCRI/gcamdata documentation built on March 21, 2023, 2:19 a.m.