Description Usage Arguments Details Value Examples
Tries to clean data for stv(). Some of the warnings from validateBallots()
have to addressed by the user (see Details).
1 | cleanBallots(x, cand.names = NULL)
|
x |
a |
cand.names |
character vector of length equal to number of candidates
(needed when column names of |
Assumes x contains rows and columns corresponding to ballots and
candidates respectively. Tries to address issues raised by validateBallots()
in the following order:
If x is a matrix then converts to data.frame.
Otherwise, user has to convert x into data.frame.
Checks if x has numeric entries. If not, checks if numeric
data was passed as character. If this also fails, then user has to
convert data into numeric type.
If column names of x are missing assigns cand.names as
column names. If
x already has valid column names, no need to specify cand.names.
If column names of x missing and cand.names not specified, returns
error message.
Removes blank columns.
Removes blank and/or non-sequentially ranked rows.
a data.frame compatible for stv() function.
1 2 3 | data(ballots)
cballots <- cleanBallots(ballots)
validateBallots(cballots)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.