get_filtered_votes {sejmRP} | R Documentation |
Retrieve filtered votes from a database
Description
Function get_filtered_votes
reads filtered votes from a database.
Usage
get_filtered_votes(dbname = 'sejmrp', user = 'reader',
password = 'qux94874', host = 'services.mini.pw.edu.pl',
windows = .Platform$OS.type == 'windows', clubs = character(0),
dates = character(0), terms_of_office = integer(0),
meetings = integer(0), votings = integer(0),
deputies = character(0), topics = character(0), max_rows = Inf)
Arguments
dbname |
name of database; default: 'sejmrp' |
user |
name of user; default: 'reader' |
password |
password of database; default: 'qux94874' |
host |
name of host; default: 'services.mini.pw.edu.pl' |
windows |
information of used operation system; default: .Platform$OS.type == 'windows' |
clubs |
names of clubs that will be taken to filter data from database; default: character(0) |
dates |
period of time that will be taken to filter data from database; default: character(0) |
terms_of_office |
range of terms of office's numbers that will be taken to filter data from database; default: integer(0) |
meetings |
range of meetings' numbers that will be taken to filter data from database; default: integer(0) |
votings |
range of votings' numbers that will be taken to filter data from database; default: integer(0) |
deputies |
full names of deputies that will be taken to filter data from database; default: character(0) |
topics |
text patterns that will be taken to filter data from database; default: character(0) |
max_rows |
maximum number of rows to download; default: Inf |
Details
Function get_filtered_votes
reads filtered votes from a database.
The result of this function is an invisible data frame with statements' data.
Possible filters:
clubs - names of clubs. This filter is a character vector with elements like for example: 'PO', 'PiS', 'SLD'. It is possible to choose more than one club.
dates - period of time. This filter is a character vector with two elements in date format 'YYYY-MM-DD', where the first describes left boundary of period and the second right boundary. It is possible to choose only one day, just try the same date as first and second element of vector.
terms_of_office - range of terms of office's numbers. This filter is a integer vector with two elements, where the first describes a left boundary of range and the second a right boundary. It is possible to choose only one term of office, just try the same number as first and second element of vector.
meetings - range of meetings' numbers. This filter is a integer vector with two elements, where the first describes a left boundary of range and the second a right boundary. It is possible to choose only one meeting, just try the same number as first and second element of vector.
votings - range of votings' numbers. This filter is a integer vector with two elements, where the first describes a left boundary of range and the second a right boundary. It is possible to choose only one voting, just try the same number as first and second element of vector.
deputies - full names of deputies. This filter is a character vector with full names of deputies in format: 'surname first_name second_name'. If you are not sure if the deputy you were thinking about has second name, try 'surname first_name' or just 'surname'. There is high probability that proper deputy will be chosen. It is possible to choose more than one deputy.
topics - text patterns. This filter is a character vector with text patterns of topics that you are interested about. Note that the votings' topics are written like sentences, so remember about case inflection of nouns and adjectives and use stems of words as patterns. For example if you want to find votings about education (in Polish: szkolnictwo) try 'szkolnictw'. It is possible to choose more than one pattern.
If you did not choose any filter, the whole database will be downloaded. Note that, due to data size (<= ~150 MB) it may take few seconds / minutes to download all votes.
Because of encoding issue on Windows operation system, you also need to select if you use Windows.
Value
data frame with NULL
Note
Default parameters use privilages of 'reader'. It can only SELECT data from database.
All information is stored in PostgreSQL database.
Author(s)
Piotr Smuda
Examples
## Not run:
filtered_votes <- get_filtered_votes()
dim(filtered_votes)
# [1] 2826483 9
names(filtered_votes)
[1] 'surname_name' 'nr_term_of_office' 'club' 'vote' 'id_voting'
[6] 'nr_meeting' 'nr_voting' 'date_meeting' 'topic_voting'
object.size(filtered_votes)
# 148694336 bytes
## End(Not run)