R/get_affected.R
flx_get_affected.RdFor a given amending or repealing statute, retrieves the statute(s) it
affects (the affectedDocument references in the Akoma Ntoso
document). A single amending statute can affect more than one target
statute (for example, an omnibus act amending several other acts), in
which case one row is returned per affected target.
flx_get_affected(year, number)A tibble::tibble() with the columns:
Year of the amending/repealing statute, as supplied.
Number of the amending/repealing statute, as supplied.
One of "ok" (at least one affected statute found),
"no_affected" (statute found, but no affected-document
references present), "not_found", or "error".
URI of the affected statute, or NA.
Year of the affected statute, or NA.
Number of the affected statute, or NA.
This function does not check whether the supplied statute is actually
an amendment or repeal; it simply looks for affectedDocument
references in whatever statute is requested. New statutes will
typically return status = "no_affected".
# \donttest{
# Look up affected statutes for a known amending statute
flx_download_statutes(
start_year = 2023, end_year = 2023,
categories = "amending-statute"
) |>
head(1) |>
with(flx_get_affected(year, number))
#> Year 2023 done (904 rows so far)
#> # A tibble: 1 × 6
#> source_year source_number status target_href target_year target_number
#> <int> <int> <chr> <chr> <int> <int>
#> 1 2023 2 ok /akn/fi/act/statut… 2015 1352
# }