EcologicalInferenceProcessor | R Documentation |
EcologicalInferenceProcessor
EcologicalInferenceProcessor
new()
EcologicalInferenceProcessor$new( election.name, ecological.inference.strategy, data.input.path, input.filename, scenario, location.fields, votes.field, absent.field = "ausente", parties.mapping = NULL, reverse.mapping = TRUE, potential.votes.field = NULL, ignore.fields = NULL, col.types = cols(.default = col_number()), seed = 143324 )
wallTime()
EcologicalInferenceProcessor$wallTime(expr)
generateOutput()
EcologicalInferenceProcessor$generateOutput()
loadInputPivotCandidatos()
EcologicalInferenceProcessor$loadInputPivotCandidatos( input.filename = self$input.filename )
generateNormalizedOutput()
EcologicalInferenceProcessor$generateNormalizedOutput(indicator = "perc")
makeSankeyDiagram()
EcologicalInferenceProcessor$makeSankeyDiagram(output.path = NULL)
getFilename()
EcologicalInferenceProcessor$getFilename(file.prefix, extension = "csv")
generateOutputJSON()
EcologicalInferenceProcessor$generateOutputJSON( output.path = NULL, filename = self$getFilename(paste(self$election.name, "-ein", sep = ""), extension = "json") )
getBetab()
EcologicalInferenceProcessor$getBetab()
exportBetab()
EcologicalInferenceProcessor$exportBetab( output.folder = NULL, overwrite = FALSE )
convertShares2Votes()
EcologicalInferenceProcessor$convertShares2Votes(election.df)
convertVotes2Shares()
EcologicalInferenceProcessor$convertVotes2Shares(election.df)
getSharesFields()
EcologicalInferenceProcessor$getSharesFields(election.fields)
fixLocationsAvailable()
EcologicalInferenceProcessor$fixLocationsAvailable( max.potential.votes.rel.dif = Inf )
fixEmpty()
EcologicalInferenceProcessor$fixEmpty()
checkDefinitions()
EcologicalInferenceProcessor$checkDefinitions()
runScenario()
EcologicalInferenceProcessor$runScenario( include.blancos = TRUE, include.ausentes = TRUE, max.potential.votes.rel.dif = Inf )
showResultsSummary()
EcologicalInferenceProcessor$showResultsSummary(election.df, description)
expectCompatible()
EcologicalInferenceProcessor$expectCompatible( output.table.expected, tolerance.rel = 0.1 )
clone()
The objects of this class are cloneable with this method.
EcologicalInferenceProcessor$clone(deep = FALSE)
deep
Whether to make a deep clone.
ken4rab
library(ElectionsLATAM) library(readr) costa.rica.ein.path <- file.path(getPackageDir(), "costa-rica") ecological.inference.calvo <- EcologicalInferenceStrategyCalvoEtAl$new() costa.rica.ein <- EcologicalInferenceProcessor$new( ecological.inference.strategy = ecological.inference.calvo, election.name = "2022-costa-rica-general-ballotage-n4", scenario = "final", data.input.path = costa.rica.ein.path, input.file = "2021-generales_pivot_candidatos_n4.csv", location.fields = c("id_unidad"), votes.field = "votos", # potential.votes.field = "habilitados", ignore.fields = "habilitados", col.types = cols( .default = col_number(), id_unidad = col_character() ) ) dummy <- costa.rica.ein$loadInputPivotCandidatos() costa.rica.ein$output.election <- readr::read_delim( file.path( costa.rica.ein.path, paste("2022-ballotage_pivot_candidatos_n4.csv", sep = "_") ), delim = ";", col_types = cols( .default = col_double(), id_unidad = col_character() ) ) costa.rica.ein$runScenario(include.blancos = TRUE, include.ausentes = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.