14
14
# ' @param deputy name of database
15
15
# ' @param host name of host; default: 'services.mini.pw.edu.pl'
16
16
# ' @param windows information of used operation system; default: TRUE
17
- # '
17
+ # '
18
18
# ' @return data frame with two columns: id_deputy, surname_name
19
19
# '
20
20
# ' @examples
21
21
# ' \dontrun{
22
22
# ' statements <- get_statements_table()
23
23
# ' statements_match_deputies_ids(statements[1000,2])
24
24
# ' statements_match_deputies_ids(statements[2000,2])}
25
- # '
25
+ # '
26
26
# ' @note
27
27
# ' All information is stored in PostgreSQL database.
28
- # '
28
+ # '
29
29
# ' @author Piotr Smuda
30
30
# '
31
31
# ' @export
@@ -35,14 +35,14 @@ statements_match_deputies_ids <- function(deputy,
35
35
host = ' services.mini.pw.edu.pl' ,windows = TRUE ){
36
36
stopifnot(is.character(deputy ),is.character(host ),
37
37
is.logical(windows ))
38
-
38
+
39
39
# extracting all words from deputy
40
40
words <- unlist(stri_extract_all_words(deputy ))
41
41
42
42
# extracting all words for every deputy in deputies table
43
43
deputies <- get_deputies_table(host = host ,windows = windows )
44
44
deputies_words <- stri_extract_all_words(deputies [,2 ])
45
-
45
+
46
46
# finding correct deputy
47
47
for (i in seq_len(length(deputies_words ))){
48
48
inter <- intersect(deputies_words [[i ]],words )
@@ -51,21 +51,21 @@ statements_match_deputies_ids <- function(deputy,
51
51
break
52
52
}
53
53
}
54
-
54
+
55
55
# picking correct deputy
56
56
deputy <- deputies [i ,c(1 ,2 )]
57
-
57
+
58
58
return (deputy )
59
59
}
60
60
61
61
# testy
62
62
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