score {quest} | R Documentation |
Observed Unweighted Scoring of a Set of Variables/Items
Description
score
calculates observed unweighted scores across a set of variables/items.
If a row's frequency of observed data is less than (or equal to)
ov.min
, then NA is returned for that row. data[vrb.nm]
is
coerced to a matrix before scoring. If the coercion leads to a character
matrix, an error is returned.
Usage
score(
data,
vrb.nm,
avg = TRUE,
ov.min = 1,
prop = TRUE,
inclusive = TRUE,
impute = TRUE,
std = FALSE,
std.data = std,
std.score = std
)
Arguments
data |
data.frame or numeric/logical matrix |
vrb.nm |
character vector of colnames in |
avg |
logical vector of length 1 specifying whether mean scores (TRUE) or sum scores (FALSE) should be created. |
ov.min |
minimum frequency of observed values required per row. If
|
prop |
logical vector of length 1 specifying whether |
inclusive |
logical vector of length 1 specifying whether the score
should be calculated (rather than NA) if the frequency of observed values
in a row is exactly equal to |
impute |
logical vector of length 1 specifying if missing values should
be imputed with the mean of observed values from each row of
|
std |
logical vector of length 1 specifying whether 1)
|
std.data |
logical vector of length 1 specifying whether
|
std.score |
logical vector of length 1 specifying whether the score should be standardized after creation. |
Value
numeric vector of the mean/sum of each row or NA
if the
frequency of observed values is less than (or equal to) ov.min
. The
names are the rownames of data
.
See Also
scores
rowMeans_if
rowSums_if
scoreItems
Examples
score(data = attitude, vrb.nm = c("complaints","privileges","learning","raises"))
score(data = attitude, vrb.nm = c("complaints","privileges","learning","raises"),
std = TRUE) # standardized scoring
score(data = airquality, vrb.nm = c("Ozone","Solar.R","Temp"),
ov.min = 0.75) # conditional on observed values