eftFormatter: eftFormatter function

Description Usage Arguments Value Examples

View source: R/eftFormatter.R

Description

This function reformats the data for its use with Election Forensics Toolkit.

Usage

1
eftFormatter(x, Nvalid = "CEC", levels = TRUE)

Arguments

x

the object from Databuilder/DataMerger function.

Nvalid

valid votes computed using either "CEC" (using the Central Election Comission's formula); "AllVotes" (total number of votes cast for all candidates).

levels

add information on levels (TRUE) or not (FALSE) to the output.

Value

Returns the data.frame object with three variables: "Votes" (number of ballots for the leading parties or candidates), "Nvalid" (number of casted ballots), "Voters" (number of eligible voters).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(CECscraper)

 murl <- "http://notelections.online/region/izbirkom?action=show&vrn=27720002327736&region=77&prver=0&pronetvd=null"
uiks <- listURLextractor(
            rowURLextractor(
               listURLextractor(
                   listURLextractor(murl))[1:5,], 'sayt izbiratel`noy komissii sub`yekta'))
uiks_voting <- rowURLextractor(uiks, "Rezul`taty vyborov|vyborov po odnomandatnomu \\(mnogomandatnomu\\) okrugu")
uiks_voting_data <- dataBuilder(uiks_voting, bylevel="level1", ttime=FALSE)
uiksEFT <- eftFormatter(uiks_voting_data)

kkalininMI/CECscraper documentation built on Oct. 28, 2020, 1:47 a.m.