Description Usage Arguments Value Examples
View source: R/precinct_processing_functions.R
This function is designed to take a wide dataset with one row per precinct and candidate vote columns and reshape once the initial pre-processing is done. The file to import should have have a precinct column, followed by columns with vote results formatted as "candidate - party". The resulting dataframe will be long/tidy data with these columns: precinct, office, district, party, votes.
1 | reshape_precinct_data(df, office, district)
|
df |
formatted dataframe of county precinct-level results |
office |
which office the results refer to (e.g. "presidential", "U.S. House", "State Senate", etc.) |
district |
number for what district is associated with the office (e.g. "45" for the 45th congressional district. note presidential should be left blank as "") |
a reshaped dataframe in openelex long/tidy format
1 2 3 4 | ## Not run:
reshape_precinct_data(mydataframe)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.