
R6 class for producing easily re-computable ScoreTable
CompScoreTable.Rd
Computable ScoreTable class. It can compute and store
ScoreTables
for multiple variables containing raw score results.
After computation, it could be also used to compute new standardized scores for provided raw scores and integrate them into stored tables.
summary() function can be used to get general information about
CompScoreTable object.
Methods
Method new()
Initialize a CompScoreTable object. You can attach one or many
StandardScale and FrequencyTable objects
Usage
CompScoreTable$new(tables = NULL, scales = NULL)Arguments
tablesNamed list of
FrequencyTableobjects to be attached. Names will indicate the name of variable for which the table is calculated. Defaults toNULL, so no tables will be available at the beginning.scalesStandardScaleobject or list of such objects to be attached. They will be used for calculation ofScoreTables.Defaults toNULL, so no scales wil be available at the beginning.
Method attach_StandardScale()
Attach new scale to the object. If there are any ScoreTables already computed, score for newly-attached scale will be computed automatically.
Method attach_FrequencyTable()
Attach previously generated FrequencyTable for a given
variable. ScoreTable containing every attached scale will be calulcated
automatically based on every new FrequencyTable.
Usage
CompScoreTable$attach_FrequencyTable(
ft,
var,
if_exists = c("stop", "append", "replace")
)Method export_ScoreTable()
Export list of ScoreTables from the object
Method standardize()
Compute standardize scores for data.frame of raw scores.
Additionally, the raw scores can be used to recalculate ScoreTables
before computing (using calc = T).
Usage
CompScoreTable$standardize(data, what, vars = names(data), calc = FALSE)Arguments
datadata.frame containing raw scores.
whatthe values to get. One of either:
quan- the quantile of raw score in the distributionZ- normalized Z score for the raw scoresname of the scale attached to the
CompScoreTableobject
varsvector of variable names which will taken into account
calcshould the
ScoreTablesbe computed (or recalculated, if some are already provided?). Default toTRUE