R/xml.R
add_xml_data_generate_levels.Rd
We have the ability to create as many levels of "subsector" nesting as we
want but in doing so we want to avoid having to make an explict copy of
the headers / LEVEL2_DATA_NAMES. So we provide this method which will instruct
the ModelIntercae to generate the addtional levels automatically. It assumes
the data in the base header is provided as is and the additional columns needed
for nesting will be moved to the end (see detail for the column_name
and
column_order_lookup
params).
add_xml_data_generate_levels(
dot,
data,
header,
old_tag,
new_tag,
num_levels,
rename_final,
column_name = old_tag,
column_order_lookup = header
)
The current state of the pipeline started from create_xml
The tibble of data to add to the conversion
The base header tag to can be looked up in the header file to
convert data
besides the additional levels of nesting.
The XML tag which is being expanded to add more levels
The XML tag which will serve as the additional levels
The number of additional levels to generate
Whether to rename the final old_tag
to
new_tag
in the original header
The base name of the column in data
which will get
expanded by appending paste0(column_name, (seq_len(num_levels) - 1))
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.
A "data structure" to hold the various parts needed to run the model interface CSV to XML conversion.