Package 'europarl'

Title: Scrap Data from Europarlament's Website
Description: Scrap data from europarlament's website.
Authors: Szymon Gorka
Maintainer: The package maintainer <[email protected]>
License: GPL
Version: 0.1.0
Built: 2025-01-30 11:24:43 UTC
Source: https://github.com/rOpenGov/europarl

Help Index


Creating database

Description

Function create_database creates a dabase with

Usage

create_database(dbname, user, password, host)

Get national parties, eu groups, postions

Description

Get national parties, eu groups, postions

Usage

deputies_get_history_of_services(home_page, deputy_id)

Get data about all deputies

Description

Get data about all deputies

Usage

get_all_deputies(term = 1)

Get data about all deputies

Description

Get data about all deputies

Usage

get_eurogroup(deputy_id, date = Sys.Date())

Get parties, eu groups, postions

Description

Get parties, eu groups, postions

Usage

get_history(home_page, deputy_id)

Get all languages in europarl

Description

Get all languages in europarl

Usage

get_languages()

Get nationality, date of birth, place of birth and/or date of death

Description

Get nationality, date of birth, place of birth and/or date of death

Usage

get_more_info(home_page)

Get data about all deputies

Description

Get data about all deputies

Usage

get_nationalparty(deputy_id, date = Sys.Date())

Get all statements for P8

Description

Get all statements for P8

Usage

get_statements(deputy_id, browser)

Loads data from configuration file

Description

File should contains:

  • dbname = "dbname"

  • host = "host"

  • username = "username"

  • password = "password"

Usage

read_config(
  file = system.file("config/db_config.txt", package = "europarl"),
  delim = " "
)

Arguments

delim

a delim parametr in read_delim

name

file name or path to file

Value

A tibble with dbname, host, username and password for database conncetion.

Examples

## Not run: 
read_config()

read_config(file = "path/name.txt", delim = " ")

## End(Not run)

Safe html scrapping

Description

Function safe_html tries to download the URL several times.

Usage

safe_html(page, time = 60, attempts = 10)

Arguments

page

requested URL

time

sleep interval after each failure

attempts

max number of tries (if there is a problem with connection)

Details

Function safe_html performes 10 (by default) attempts to download the URL and waits 60sec (by default) after each failure

Value

character vector

Author(s)

Przemyslaw Biecek

Examples

## Not run: 
page <- paste0('http://www.sejm.gov.pl/Sejm7.nsf/',
               'wypowiedz.xsp?posiedzenie=15&dzien=1&wyp=008')
safe_html(page)
## End(Not run)

Get statements text and details.

Description

Function statements_core downloads content and details(language, time) of the statement.

Usage

statements_core(url)

Get all statements for P8

Description

Get all statements for P8

Usage

statements_get_all_statements(deputy_id, browser, term_of_office = 8)

Return links, titles, dates of sttamenets of given deputie.

Description

Return links, titles, dates of sttamenets of given deputie.

Usage

statements_get_list_of_statements(deputy_id, browser, term_of_office = 8)

Get statements text and details.

Description

Function statements_core downloads content and details(language, time) of the statement.

Usage

statements_get_statement(url)

Get time of statements

Description

Get time of statements

Usage

statements_get_time(url)

Arguments

url

A url of statements

Value

Returns duration, start time and end time of statement


Update stamenets in data abse

Description

Update stamenets in data abse

Usage

statements_update_statements(deputy_id, browser, term_of_office = 8, db)

Remove white signs and comapre two strings

Description

Remove white signs and comapre two strings

Usage

strings_identical(x, y)

Value

Returns TRUE or FALSE