
Extract ROCK elements a text
Source:R/extract_rock_breaks_from_text.R, R/extract_rock_class_codes_from_text.R, R/extract_rock_codes_from_text.R, and 5 more
extract_rock_elements.RdExtract ROCK elements a text
Usage
extract_rock_breaks_from_text(x)
extract_rock_class_codes_from_text(x)
extract_rock_codes_from_text(x)
extract_rock_network_codes_from_text(x)
extract_rock_notes_from_text(x)
extract_rock_tree_codes_from_text(x)
extract_rock_uids_from_text(x)
extract_rock_value_codes_from_text(x)Value
An object containing the text, both in its original version and in a version omitting the extracted elements, as well as the extracted elements.
Examples
### Extract section breaks
sectionBreaks <-
rock::extract_rock_breaks_from_text(
loadedExample
);
#> Error: object 'loadedExample' not found
### Extract tree codes
classCodes <-
rock::extract_rock_class_codes_from_text(
loadedExample
);
#> Error: object 'loadedExample' not found
### Extract all codes
allCodes <-
rock::extract_rock_codes_from_text(
loadedExample
);
#> Error: object 'loadedExample' not found
### Extract tree codes
treeCodes <-
rock::extract_rock_network_codes_from_text(
loadedExample
);
#> Error: object 'loadedExample' not found
### Get path to example source
examplePath <-
system.file("extdata", package="rock");
### Get a path to one example file
exampleFile <-
file.path(examplePath, "example-5.rock");
### Parse single example source
loadedExample <-
rock::load_source(exampleFile);
### Extract notes
notes <-
rock::extract_rock_notes_from_text(loadedExample);
notes$notes[[3]];
#> $text
#> [1] "This is a second note attached to the same data"
#> [2] "fragment. So to attach multiple notes, just leave"
#> [3] "an empty line between them."
#>
#> $lines
#> [1] 103 104 105
#>
#> $keyedValues
#> with_a_third
#> "keyed value"
#>
#> $attached_to_line
#> [1] 96
#>
#> $attached_to_data
#> [1] "sollicitudin egestas. Maecenas"
#>
#> $attached_to_uid
#> [1] "7zs2xyj6"
#>
### Extract tree codes
treeCodes <-
rock::extract_rock_tree_codes_from_text(
loadedExample
);
### Extract UIDs
UIDs <-
rock::extract_rock_uids_from_text(loadedExample);
### Extract value codes
valueCodes <-
rock::extract_rock_value_codes_from_text(
loadedExample
);