parse_MTG_section: Parse MTG section

Description Usage Arguments Value Examples

View source: R/read_MTG.R

Description

Parse any section from an MTG

Usage

1
parse_MTG_section(MTG, section_name, header, next_section, allow_empty)

Arguments

MTG

A pre-formatted MTG

section_name

The section name in the file

header

The header of the section

next_section

The name of the next section

allow_empty

Boolean. Allow the section to be empty ?

Value

A data.frame with the section results, or a tree for the MTG.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
filepath= system.file("extdata", "simple_plant.mtg", package = "XploRer")
MTG_file = strip_comments(MTG_file)
MTG_file = strip_empty_lines(MTG_file)

# Checking that all sections are present and ordered properly:
check_sections(MTG_file)
# parse the classes section from the MTG:
parse_MTG_section(MTG_file, "CLASSES:",
  c('SYMBOL', 'SCALE', 'DECOMPOSITION', 'INDEXATION', 'DEFINITION'),
  "DESCRIPTION:",FALSE)

## End(Not run)

VEZY/XploRer documentation built on Oct. 9, 2021, 10:05 p.m.