similar_votes: Obtain similarities a vote result shares with other votes

Description Usage Arguments Value Examples

View source: R/similar_votes.R

Description

similar_votes allows to obtain correlations of specified vote with other votes.

Usage

1
2
3
4
5
6
7
similar_votes(
  federalvotes = NULL,
  id = NULL,
  corr = TRUE,
  from = NULL,
  to = NULL
)

Arguments

federalvotes

tibble or data.frame that is returned by 'get_swissvotes'.

id

identification number of the vote, needs four digits. Vote 626 (Zersiedelungsinitiative) needs 6260.

corr

set to TRUE by default. If FALSE return the variance-covariance matrix.

from

lower limit of correlations.

to

upper limit of correlations.

Value

a tibble containing the results

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 
 
 fedvotes <- get_nationalvotes(geolevel = "canton",from_date = "2010-03-07",to_date="2019-02-10")
 
 #Find correlating votes for the 'Zersiedelungsinitiative', 2019-02-10
 results <- similar_votes(fedvotes, id=6260)
 

#Zersiedelungsinitiative, 2019-02-10, filter stronger correlations (>0.5)
 results <- similar_votes(fedvotes, id=6260, from = 0.5)

swissdd documentation built on July 17, 2021, 9:06 a.m.