Skip to contents

[Experimental] 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

tables

Named list of FrequencyTable objects to be attached. Names will indicate the name of variable for which the table is calculated. Defaults to NULL, so no tables will be available at the beginning.

scales

StandardScale object or list of such objects to be attached. They will be used for calculation of ScoreTables. Defaults to NULL, so no scales wil be available at the beginning.

Details

Both FrequencyTable and StandardScale objects can be attached with appropriate methods after object initialization.

Returns

CompScoreTable object


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.

Usage

CompScoreTable$attach_StandardScale(scale, overwrite = FALSE)

Arguments

scale

StandardScale object defining a scale

overwrite

boolean indicating if the definition for a scale of the same name should be overwritten


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")
)

Arguments

ft

FrequencyTable to be attached

var

String with the name of the variable

if_exists

Action that should be taken if FrequencyTable for given variable already exists in the object.

  • stop DEFAULT: don't do anything

  • append recalculates existing table

  • replace replaces existing table


Method export_ScoreTable()

Export list of ScoreTables from the object

Usage

CompScoreTable$export_ScoreTable(vars = NULL, strip = FALSE)

Arguments

vars

Names of the variables for which to get the tables. If left at NULL default - get all off them.

strip

logical indicating if the ScoreTables should be stripped down to FrequencyTables during export. Defaults to FALSE

Returns

list of ScoreTable or FrequencyTable 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

data

data.frame containing raw scores.

what

the values to get. One of either:

  • quan - the quantile of raw score in the distribution

  • Z - normalized Z score for the raw scores

  • name of the scale attached to the CompScoreTable object

vars

vector of variable names which will taken into account

calc

should the ScoreTables be computed (or recalculated, if some are already provided?). Default to TRUE

Returns

data.frame with standardized values


Method clone()

The objects of this class are cloneable with this method.

Usage

CompScoreTable$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.