Title: | Work with the Boletin Oficial del Estado of Spain |
---|---|
Description: | Queries the online site of the Boletin Oficial del Estado (BOE) for data. |
Authors: | Lluís Revilla Sancho [aut, cre]
|
Maintainer: | Lluís Revilla Sancho <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.8.9007 |
Built: | 2024-08-30 05:23:16 UTC |
Source: | https://github.com/rOpenSpain/BOE |
Given an id check if it is valid.
check_code(id) valid_code(id, sumario = TRUE, BORME = FALSE)
check_code(id) valid_code(id, sumario = TRUE, BORME = FALSE)
id |
ID or CVE of the document (character). |
sumario |
Logical value if sumarios should be accepted. |
BORME |
Logical value if BORME journal should be accepted. |
A logical value if correct, errors if something is not right.
valid_code()
: Returns logic values
check_code("BOE-S-20141006") # Normal way check_code("BOE-S-2014-242") # Also accepted but not documented # Will fail: # check_code("BOE-S-2014") valid_code("BOE-S-2014")
check_code("BOE-S-20141006") # Normal way check_code("BOE-S-2014-242") # Also accepted but not documented # Will fail: # check_code("BOE-S-2014") valid_code("BOE-S-2014")
Functions to create CVE codes for the documents published on the BOE.
disposicion_cve(year, number) disposicion(year, number) anuncio_cve(year, number) anuncio(year, number)
disposicion_cve(year, number) disposicion(year, number) anuncio_cve(year, number) anuncio(year, number)
year |
Character or numeric value of the year of the element in YYYY format. |
number |
Character or numeric value of the element. |
A character vector
disposicion_cve()
: Create the CVE of the diposicion.
disposicion()
: For compatibility with previous version
anuncio_cve()
: Create the CVE of the anuncio.
anuncio()
: For compatibility with previous version
Other code generators:
sumario_cve()
,
sumario_nbo()
disposicion_cve(2019, 242) anuncio_cve(2019, 242)
disposicion_cve(2019, 242) anuncio_cve(2019, 242)
Look up on the internet and get the content
get_xml(query)
get_xml(query)
query |
A query to BOE. |
id <- sumario_nbo(format(as.Date("2017/10/02", "%Y/%m/%d"), "%Y%m%d")) url <- query_xml(id) get_xml(url)
id <- sumario_nbo(format(as.Date("2017/10/02", "%Y/%m/%d"), "%Y%m%d")) url <- query_xml(id) get_xml(url)
Returns the date of the last BOE under normal circumstances.
last_date_boe()
last_date_boe()
A date.
last_date_boe()
last_date_boe()
This function opens urls in your browser.
open_publications(sumario)
open_publications(sumario)
sumario |
A tidy sumario. |
A tab should open on your default browser with the pdf of the publications.
## Not run: sumario <- retrieve_sumario(last_date_boe()) url_publications(sumario[1:10, ]) ## End(Not run)
## Not run: sumario <- retrieve_sumario(last_date_boe()) url_publications(sumario[1:10, ]) ## End(Not run)
Look for the consolidated law online
query_consolidada(cve)
query_consolidada(cve)
cve |
The CVE of the document you want. |
A query url.
cve <- disposicion_cve("2017", "117") query_consolidada(cve)
cve <- disposicion_cve("2017", "117") query_consolidada(cve)
Build a query for the webpage
query_htm(cve)
query_htm(cve)
cve |
The CVE of the document you want. |
A query url.
query_consolidada
cve <- sumario_cve("2017", "117") query_htm(cve)
cve <- sumario_cve("2017", "117") query_htm(cve)
To query a pdf you must know the number of the piece you are looking for and the date it was published.
query_pdf(year, month, day, code)
query_pdf(year, month, day, code)
year |
Character of the number of the year: YYYY |
month |
Character of the number of the month: MM. |
day |
Character of the number of the day: DD. |
code |
Code of the publication to query. |
A link to the pdf.
cve <- sumario_cve("2017", "237") query_pdf("2017", "10", "02", cve)
cve <- sumario_cve("2017", "237") query_pdf("2017", "10", "02", cve)
Build a query for an XML
query_xml(id)
query_xml(id)
id |
The id of the xml document you want. |
A query for the xml.
id <- sumario_nbo(format(as.Date("2017/10/02", "%Y/%m/%d"), "%Y%m%d")) cve <- sumario_cve("2017", "237") # Same document but by the CVE query_xml(id) query_xml(cve)
id <- sumario_nbo(format(as.Date("2017/10/02", "%Y/%m/%d"), "%Y%m%d")) cve <- sumario_cve("2017", "237") # Same document but by the CVE query_xml(id) query_xml(cve)
Tidy data from any document published on the BOE and BORME from the BOE.
retrieve_document(cve)
retrieve_document(cve)
cve |
Character with the code of the document. |
Other functions to retrieve documents:
retrieve_sumario()
cve <- "BOE-A-2020-12109" df <- retrieve_document(cve)
cve <- "BOE-A-2020-12109" df <- retrieve_document(cve)
Obtain a sumario and tidy it in a table.
retrieve_sumario(date, journal = "BOE")
retrieve_sumario(date, journal = "BOE")
date |
A Date of the sumario. |
journal |
Either BOE or BORME. |
A data.frame with one line for each publication.
tidy_sumario to learn about the format of the output
Other functions to retrieve documents:
retrieve_document()
retrieve_sumario(last_date_boe())
retrieve_sumario(last_date_boe())
Create the number of the sumario
sumario_cve(year, number, journal = "BOE") sumario(year, number, journal = "BOE")
sumario_cve(year, number, journal = "BOE") sumario(year, number, journal = "BOE")
year |
Character or numeric value of the year of the summary in YYYY format. |
number |
Number of the summary in NNN format. |
journal |
Either BOE or BORME. |
A character vector with the CVE of the sumario.
sumario()
: For compatibility with previous version
sumario_nbo()
if you want to retrieve the sumario by date and don't know the CVE.
Other code generators:
element
,
sumario_nbo()
sumario_cve(2019, 242)
sumario_cve(2019, 242)
Creates the id for a sumario by the date it was published.
sumario_nbo(date, journal = "BOE") sumario_xml(date, journal = "BOE")
sumario_nbo(date, journal = "BOE") sumario_xml(date, journal = "BOE")
date |
Date of the sumario |
journal |
Either BOE or BORME. |
A character vector
sumario_xml()
: For compatibility with previous version
The id is different from the CVE, which can be created with sumario_cve()
.
Other code generators:
element
,
sumario_cve()
sumario_nbo(Sys.Date()) sumario_nbo(format(as.Date("2009/01/01", "%Y/%m/%d"), "%Y%m%d"), journal = "BORME")
sumario_nbo(Sys.Date()) sumario_nbo(format(as.Date("2009/01/01", "%Y/%m/%d"), "%Y%m%d"), journal = "BORME")
Creates the CVE of a summary of the supplements, either the judicial or notifications. These are only available for 3 months.
sumario_suplementos(year, number, type = "N")
sumario_suplementos(year, number, type = "N")
year |
Character or numeric value of the year of the summary in YYYY format. |
number |
Number of the summary in NNN format. |
type |
Either J or N. J for judicial or N for notificaciones |
A CVE of the document
sumario_suplementos(2023, 1)
sumario_suplementos(2023, 1)
Creates the CVE of a supplement, either the judicial or notifications. These are only available for 3 months.
suplemento_cve(year = 2023, number, type = "J")
suplemento_cve(year = 2023, number, type = "J")
year |
Character or numeric value of the year of the summary in YYYY format. |
number |
Number of the summary in NNN format. |
type |
Either J or N. J for judicial or N for notificaciones |
A CVE.
suplemento_cve(number = 1)
suplemento_cve(number = 1)
Cleans in a tidy format the sumario file
tidy_sumario(x)
tidy_sumario(x)
x |
A XML file. |
A data.frame with one line for each publication. Including date, sumario number, section, section text, departament, departament number, epigraph, brief text, publication code and number of pages of the pdf.
id <- sumario_nbo(format(as.Date("2017/10/02", "%Y/%m/%d"), "%Y%m%d")) sumario_file <- get_xml(query_xml(id)) m <- tidy_sumario(sumario_file) head(m) tail(m)
id <- sumario_nbo(format(as.Date("2017/10/02", "%Y/%m/%d"), "%Y%m%d")) sumario_file <- get_xml(query_xml(id)) m <- tidy_sumario(sumario_file) head(m) tail(m)
Transform the date and publication code to the urls to the publications on pdf format.
url_publications(sumario)
url_publications(sumario)
sumario |
A tidy sumario. |
A character vector with the urls to get the publications in pdf format.
retrieve_sumario to obtain sumarios, and tidy_sumario to know the expected input.
sumario <- retrieve_sumario(last_date_boe()) url_publications(sumario[1:10, ])
sumario <- retrieve_sumario(last_date_boe()) url_publications(sumario[1:10, ])