get_filtered_statements {sejmRP} | R Documentation |
Retrieve filtered statements from a database
Description
Function get_filtered_statements
reads filtered statements from a database.
Usage
get_filtered_statements(dbname = 'sejmrp', user = 'reader',
password = 'qux94874', host = 'services.mini.pw.edu.pl',
windows = .Platform$OS.type == 'windows', terms_of_office = integer(0),
deputies = character(0), dates = character(0), topics = character(0),
content = 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' |
terms_of_office |
range of terms of office's 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) |
dates |
period of time 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) |
content |
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_statements
reads filtered statements from a database.
The result of this function is an invisible data frame with statements' data.
Possible filters:
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.
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.
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.
topics - text patterns. This filter is a character vector with text patterns of topics in order points. Note that the order points 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 order points about education (in Polish: szkolnictwo) try 'szkolnictw'. It is possible to choose more than one pattern.
content - text patterns. This filter is a character vector with text patterns in statements. Note that strings with statements are sentences, so remember about case inflection of nouns and adjectives and use stems of words as patterns. For example if you want to find order points 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 statements.
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)
Tomasz Mikolajczyk, Piotr Smuda
Examples
## Not run:
filtered_statements <- get_filtered_statements()
dim(filtered_statements)
# [1] 2568 6
names(filtered_statements)
[1] 'id_statement' 'nr_term_of_office' 'surname_name' 'date_statement'
[5] 'titles_order_points' 'statement'
object.size(filtered_statements)
# 6488552 bytes
## End(Not run)