parse_EL155: separate vote rows in to columns

View source: R/read_SC.R

parse_EL155R Documentation

separate vote rows in to columns

Description

Use fwf to separate out colums in vote rows. Entries need to be votes, thus they need to be a product of get_precinct_range() Data looks like 5123906 2 * 10 Nikki R Haley GOVERNOR

Usage

parse_EL155(
  votes,
  vote_col = "text",
  start_pos = c(1, 9, 14, 16, 21, 61),
  end_pos = c(7, 12, 14, 19, 59, 131),
  col_names = c("machine", "ballot_style", "marker", "choice_id", "choice_name",
    "contest_name")
)

Arguments

votes

data frame with row

vote_col

column name (in characters) where the votes are

start_pos

numerical vector of start char positions

end_pos

numerical vector of end char positions

col_names

names of variables for each column

Examples

data(G2016_Dillon_EL155)
dillon_p <- get_precinct(G2016_Dillon_EL155)
wprecinct <- add_precinct(G2016_Dillon_EL155, dillon_p)
df <- parse_EL155(wprecinct)

kuriwaki/ballot documentation built on July 29, 2024, 11:10 a.m.