Description Usage Arguments Value Examples
Adds a prediction, so far only implemented for pollyvote objects.
1 | add_error_calc(pv, method, fun, ...)
|
pv |
[ |
method |
[ |
fun |
[ |
... |
additional arguments |
The pollyvote object with added prediction.
1 2 3 4 5 6 7 8 | pv = create_pollyvote(perm_countries = "D")
pv = add_error_calc(pv, "poll_only", function(pv) {
pred_data = predict(pv, "poll")
result = get_election_result(pv, "BTW")
joined = left_join(x = pred_data, y = result, by = "party") %>%
rename(percent = percent.x, percent.true = percent.y)
return(mutate(joined, error = abs(percent - percent.true)))
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.