# NOT RUN {
votes <- list(data.frame(country = rep("ARG", 3),
year = c(1995, 2000, 2005),
party_A = c(40,10,20),
party_B = c(35,20,40),
party_C = c(25,70,40)),
data.frame(country = rep("URY", 4),
year = c(1995, 2000, 2005, 2010),
party_A = c(30,30,20,20),
party_B = c(30,50,40, 30),
party_C = c(30,10,30, 25),
party_D = c(10,10,10,25)),
data.frame(country = rep("BRA", 2),
year = c(1993, 1998),
party_A = c(30, 55),
party_B = c(70, 45)))
votes <- convert_esaps(dataset = votes, unit.name = "country", election.name = "year")
votes2 <- data.frame(year = c(2000, 2005),
country = "URY",
votes_party1 = c(20, 30),
votes_party2 = c(30, 35),
votes_party3 = c(40, 25),
votes_party4 = c(10, 10),
seats_party1 = c(25, 35),
seats_party2 = c(20, 30),
seats_party3 = c(40, 30),
seats_party4 = c(15, 5))
votes <- convert_esaps(dataset = votes2, unit.name = "country", election.name = "year",
seats = TRUE)
# }
# NOT RUN {
v1 <- convert_esaps(path = getwd(),
file.name = c("electionBRA.xlsx", "electionARG.xlsx"),
election.name = "elec",
unit.name = "district",
allSheet = TRUE)
v2 <-convert_esaps(path = getwd(),
file.name = c("ARG.ods", "URY.ods", "BRA.ods"),
nCountry = c(2, 3, 1),
election.name = "elec",
unit.name = "province")
v3 <- convert_esaps(path = here::here(),
file.name = list.files(pattern = "*.xlsx"),
election.name = "year",
unit.name = "country",
M.name = "magnitude",
seats = TRUE,
allSheet = TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab