Description Usage Arguments Details Value Examples
View source: R/validate_clean_ballots.R
The function validateBallots
validates data format for stv()
input.
It assumes that each row corresponds to a ballot and each column corresponds to a
candidate. If input data is in the correct format, validateBallots
returns
string: "All tests passed. Please feel free to run stv()
function."
Otherwise, it prints a message corresponding to the formatting error.
1 |
x |
a |
The validateBallots
function should be run before stv()
is called.
Before any calculation, stv()
calls this function and proceeds only
if x
passes all of the following tests.
If x
is a data.frame
.
If x
has unique column names.
If x
has numeric entries.
If x
doesn't have any blank columns.
If x
doesn't have any blank rows.
If x
doesn't have any rows with non-sequential ranks.
string: "All tests passed. Please feel free to run stv() function." if x
passes all tests. Otherwise, a message corresponding to the problem is retunred.
NOTE: Some of the warnings can be fixed using cleanBallots()
function.
Other issues must be fixed by the user.
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.