Skip to content

Commit 61ef1bc

Browse files
author
Piotr Smuda
committed
encoding for statements table (windows)
1 parent f08035c commit 61ef1bc

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

sejmRP/R/get_statements_table.R

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ get_statements_table <- function(dbname = "sejmrp", user = "reader", password =
6161
# encoding for windows
6262
if (windows) {
6363
statements[, 2] <- iconv(statements[, 2], from = "UTF-8", to = "Windows-1250")
64+
statements[, 4] <- iconv(statements[, 4], from = "UTF-8", to = "Windows-1250")
6465
statements[, 5] <- iconv(statements[, 5], from = "UTF-8", to = "Windows-1250")
6566
}
6667

statements_match_deputies_ids.R

+16-16
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
#' @param deputy name of database
1515
#' @param host name of host; default: 'services.mini.pw.edu.pl'
1616
#' @param windows information of used operation system; default: TRUE
17-
#'
17+
#'
1818
#' @return data frame with two columns: id_deputy, surname_name
1919
#'
2020
#' @examples
2121
#' \dontrun{
2222
#' statements <- get_statements_table()
2323
#' statements_match_deputies_ids(statements[1000,2])
2424
#' statements_match_deputies_ids(statements[2000,2])}
25-
#'
25+
#'
2626
#' @note
2727
#' All information is stored in PostgreSQL database.
28-
#'
28+
#'
2929
#' @author Piotr Smuda
3030
#'
3131
#' @export
@@ -35,14 +35,14 @@ statements_match_deputies_ids <- function(deputy,
3535
host='services.mini.pw.edu.pl',windows=TRUE){
3636
stopifnot(is.character(deputy),is.character(host),
3737
is.logical(windows))
38-
38+
3939
#extracting all words from deputy
4040
words <- unlist(stri_extract_all_words(deputy))
4141

4242
#extracting all words for every deputy in deputies table
4343
deputies <- get_deputies_table(host=host,windows=windows)
4444
deputies_words <- stri_extract_all_words(deputies[,2])
45-
45+
4646
#finding correct deputy
4747
for(i in seq_len(length(deputies_words))){
4848
inter <- intersect(deputies_words[[i]],words)
@@ -51,21 +51,21 @@ statements_match_deputies_ids <- function(deputy,
5151
break
5252
}
5353
}
54-
54+
5555
#picking correct deputy
5656
deputy <- deputies[i,c(1,2)]
57-
57+
5858
return(deputy)
5959
}
6060

6161
#testy
6262

63-
library(sejmRP)
64-
65-
statements<-get_statements_table(host="192.168.137.38")
66-
deputies <- get_deputies_table(host="192.168.137.38")
67-
68-
a <- deputies[,2]
69-
b <- statements[,2]
70-
71-
statements_match_deputies_ids(b[3000],host="192.168.137.38")
63+
# library(sejmRP)
64+
#
65+
# statements<-get_statements_table(host="192.168.137.38")
66+
# deputies <- get_deputies_table(host="192.168.137.38")
67+
#
68+
# a <- deputies[,2]
69+
# b <- statements[,2]
70+
#
71+
# statements_match_deputies_ids(b[3000],host="192.168.137.38")

0 commit comments

Comments
 (0)