write.pollyvote: write a pollyvote prediction / error calculation

Description Usage Arguments Value Examples

View source: R/write_pollyvote.R

Description

writes the result of a prediction of a pollyvote object to a .csv file.

Usage

1
2
write.pollyvote(x, file = "", method = "write.table", prediction = NULL,
  error_calculation = NULL, write_args = list(), ...)

Arguments

x

[pollyvote(1)]
pollyvote object to predict from.

file

[character(1)]
either a character string naming a file or a connection open for writing. "" indicates output to the console.

method

[character(1)]
function name of the write function to use. Currently supported are 'write.table', 'write.csv' and 'write.csv2'.

prediction

[character(1)]
method of the prediction to be plotted.

error_calculation

[character(1)]
method of the error_calculation to be plotted.

write_args

[list()]
list of arguments to the write function specified in method.

...

additional arguments to the prediction or error calculation function.

Value

Nothing. A file is created.

Examples

1
2
3
4
5
6
pv = create_pollyvote(perm_countries = "D")
data("polls_individual")
pv = add_data(pv, newdata = polls_individual, country = "D", region = "national", 
              source_type = "poll", election = "BTW")
write.pollyvote(pv, file = "pred.csv", method = "write.table", 
                prediction = "pollyvote")

pollyvote/pollyvoter documentation built on April 4, 2018, 8:18 p.m.