danlex

R-CMD-check

Access Danish acts, regulations and treaties from Retsinformation, the official state legal information system, through its European Legislation Identifier (ELI) service.

danlex is part of lexverse, a family of R packages for legal and regulatory data alongside eurlex, finlex and swelex.

Installation

# install.packages("pak")
pak::pak("KristianVepsalainen/danlex")

Usage

Danish instruments are cited by year and number, which maps directly onto an identifier:

library(danlex)

doc <- dlx_get_doc("lta", 1998, 763)
doc$title
#> [1] "Bekendtgørelse om indbetaling af Den Særlige Pensionsopsparing for medlemmer af arbejdsløshedskasser for lønmodtagere ved udbetaling af dagpenge m.v."
doc$document_type
#> [1] "Bekendtgørelse"

Text is structured down to the subsection, so provisions can be handled as data rather than parsed out of a blob:

p <- dlx_get_paragraphs("lta", 2025, 50)
p[1:3, c("paragraf", "stk", "text")]
#> # A tibble: 3 × 3
#>   paragraf stk     text                                                         
#>   <chr>    <chr>   <chr>                                                        
#> 1 § 1.     <NA>    Formålet med erhvervsakademiuddannelsen som maritim teknolog…
#> 2 § 1.     Stk. 2. Den uddannede skal have viden, færdigheder og kompetencer (l…
#> 3 § 1.     Stk. 3. Den uddannede, som har gennemført de maritime valgfag, skal …

Cross-references come as an edge table, and the accession numbers it returns can be fed straight back in:

refs <- dlx_get_references("lta", 1998, 763)
refs[, c("ref_accn", "ref_date", "ref_title")]
#> # A tibble: 2 × 3
#>   ref_accn     ref_date   ref_title                                             
#>   <chr>        <date>     <chr>                                                 
#> 1 A19990059229 1999-07-14 Bekendtgørelse af lov om arbejdsløshedsforsikring m.v.
#> 2 A19990066629 1999-08-19 Bekendtgørelse af lov om en aktiv arbejdsmarkedspolit…

dlx_get_doc(accn = refs$ref_accn[1])$title
#> [1] "Bekendtgørelse af lov om arbejdsløshedsforsikring m.v."

See vignette("danlex") for a fuller walk-through.

Functions

Function Purpose
dlx_get_doc() Metadata for one document
dlx_get_docs() Metadata for many, with error recovery
dlx_get_text() Running text
dlx_get_paragraphs() One row per provision
dlx_get_references() Citations as an edge table
dlx_get_changes() Recent changes, at least 60 days
dlx_list_documents() The whole corpus index
dlx_index_status(), dlx_clear_index() Manage the session index

Coverage

Around 200,000 documents in seven collections:

Code Content Coverage
lta Lovtidende A — acts and regulations 1852–
ltb, ltc Lovtidende B and C — the latter treaties 1936–
mt Ministerialtidende 1871–2012
retsinfo Administrative decisions 1665–
fob Ombudsman decisions 1980–
ft Folketinget documents by session

Three points worth knowing before relying on the data:

Full text begins in late 2007. Retsinformation returns document content only for material published from 25 September 2007 onward; earlier documents carry metadata alone, reported as status = "metadata_only". Metadata itself is complete for the whole range above.

Some collections have ended. Ministerialtidende was discontinued in 2012 and treaty publication drops off sharply after 2008. An empty result for a given year may mean nothing was published rather than that something is missing.

References are maintained, not historical. Cross-references point at the current consolidated version of the parent instrument, so a 1998 regulation commonly cites acts dated 1999 or later. Any citation network built from this data must account for that.

Terms of use

Data is provided by Civilstyrelsen. Consult the terms at https://www.retsinformation.dk/api before redistributing it or using it commercially. danlex is licensed MIT; the underlying data is not covered by that licence.