Retrieves the body text of a Finnish statute from the Finlex Open Data API, split into one row per section (pykälä). This complements flx_get_metadata(), which only reports the number of sections; this function returns their actual content.

flx_get_text(year, number)

Arguments

year

Integer vector. Year(s) of the statute(s).

number

Integer vector. Number(s) of the statute(s) within that year. Recycled against year if shorter.

Value

A tibble::tibble() with one row per section (or one row with NA section fields if the statute has no sections, was not found, or an error occurred) and the columns:

year

Year of the statute, as supplied.

number

Number of the statute, as supplied.

status

One of "ok", "no_sections" (statute found, but contains no section elements — for example a very short decision), "not_found", or "error".

section_index

Integer. The section's position within the statute (1-based), in document order.

section_id

Character. The section's Akoma Ntoso eId attribute, if present (for example "sec_1").

heading

Character. The section heading, if present.

text

Character. The full text of the section, including its heading.

Details

Statutes can be long. Calling this function for many statutes at once will be slow and will retrieve a large amount of text — consider narrowing down to the statutes you actually need (for example with flx_download_statutes() or flx_get_metadata()) before calling this function.

Examples

# \donttest{
flx_get_text(year = 1992, number = 1535) # Tuloverolaki, all sections
#> # A tibble: 155 × 7
#>     year number status section_index section_id            heading         text 
#>    <int>  <int> <chr>          <int> <chr>                 <chr>           <chr>
#>  1  1992   1535 ok                 1 part_1__chp_1__sec_1  Tulovero ja ve… "1 §…
#>  2  1992   1535 ok                 2 part_1__chp_1__sec_2  Tuloverotusta … "2 §…
#>  3  1992   1535 ok                 3 part_1__chp_2__sec_3  Yhteisö         "3 §…
#>  4  1992   1535 ok                 4 part_1__chp_2__sec_4  Yhtymä          "4 §…
#>  5  1992   1535 ok                 5 part_1__chp_2__sec_5  Yhteisetuus     "5 §…
#>  6  1992   1535 ok                 6 part_1__chp_2__sec_6  Kiinteistö      "6 §…
#>  7  1992   1535 ok                 7 part_1__chp_2__sec_7  Puolisot        "7 §…
#>  8  1992   1535 ok                 8 part_1__chp_2__sec_8  Alaikäinen lap… "8 §…
#>  9  1992   1535 ok                 9 part_2__chp_1__sec_9  Yleinen ja raj… "9 §…
#> 10  1992   1535 ok                10 part_2__chp_1__sec_10 Suomesta saatu… "10 …
#> # ℹ 145 more rows
# }