read_clauses: Read treaty articles by number or match

View source: R/read_clauses.R

read_clausesR Documentation

Read treaty articles by number or match

Description

The function splits treaty texts into lists that reflect a structure based on having a preamble and several articles. Once articles are split, users can access the "preambles", "accession" and "termination" clauses, or "annexes" within a collection of treaty texts. The selection of each of these articles relies on regex matching certain expressions unique to each of them. Alternatively, users can get all the articles that contain a certain 'desired' word within a collection of treaty texts. As well, users can select only certain types of treaties for which specific articles are to be returned (e.g. agreements).

Usage

read_clauses(textvar, article = NULL, match = NULL, treaty_type = NULL)

Arguments

textvar

A text variable

article

Would you like to get a specific article? Null by default. Other options include the "preamble", the "termination" clauses, "membership" clauses, or the "annex". The specified portion for all treaties will be returned.

match

A regex match for a word(s) or expression. For multiple words, please use "|" to divide them.

treaty_type

Would you like to get certain types of treaty only? Null by default. Other treaty types include: "agreements", "protocols", "amendments", "notes", "memorandum", and "resolutions".

Details

Please make sure treaty texts have been standardised first using standardise_texts() for best results.

Value

A list of treaty sections of the same length.

Examples

## Not run: 
t <- standardise_treaty_text(sample(manyenviron::agreements$HUGGO$MainText, 30))
read_clauses(t)
read_clauses(t, article = "preamble")
read_clauses(t, article = "accession")
read_clauses(t, article = "termination")
read_clauses(t, article = "annex")
read_clauses(t, match = "constitution")
read_clauses(t, article = "preamble", match = "amend")
read_clauses(t, treaty_type = "agreements")
read_clauses(t, treaty_type = "protocols")
read_clauses(t, treaty_type = "amendments")

## End(Not run)

globalgov/qCreate documentation built on April 27, 2023, 3:27 a.m.