Since scaling functions such as scale_weighted only apply to
data.frames with code percentages, the function mp_scale makes them
applies them to a ManifestoCorpus or ManifestoDocument.
mp_scale(
data,
scalingfun = rile,
scalingname = as.character(substitute(scalingfun)),
recode_v5_to_v4 = (scalingname %in% c("rile", "logit_rile")),
...
)document_scaling(
scalingfun,
returndf = FALSE,
scalingname = "scaling",
recode_v5_to_v4 = FALSE,
...
)
corpus_scaling(
scalingfun,
scalingname = "scaling",
recode_v5_to_v4 = FALSE,
...
)
ManifestoDocument or ManifestoCorpus with coding
annotations or a data.frame with category percentages
a scaling function, i.e. a function that takes a data.frame with
category percentages and returns scaled positions, e.g. scale_weighted.
the name of the scale which will be used as a column name when a data.frame is produced
recode handbook version 5 scheme to version 4 before scaling; this parameter is only relevant if data is a ManifestoDocument or ManifestoCorpus, but not for data.frames with code percentages
further arguments passed on to the scaling function scalingfun,
or count_codes
if this flag is TRUE, a data.frame with category percentage values, scaling result and, if available party and date is returned by the returned function