Description Usage Arguments Value See Also Examples
View source: R/quest_functions.R
scores
calculates observed unweighted scores across multiple sets 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. Each set of
variables/items are coerced to a matrix before scoring. If the coercion leads
to a character matrix, an error is returned. This can be tested with
lapply(X = vrb.nm.list, FUN = function(nm)
is.character(as.matrix(data[nm])))
.
1 2 3 4 5 6 7 8 9 10 11 12 
data 
data.frame or numeric/logical matrix 
vrb.nm.list 
list where each element is a 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 scores
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) the variables
should be standardized before scoring and 2) the score standardized after
creation. This argument is for convenience as these two standardization
processes are often used together. However, this argument will be
overwritten by any nondefault value for 
std.data 
logical vector of length 1 specifying whether the variables/items should be standardized before scoring. 
std.score 
logical vector of length 1 specifying whether the scores should be standardized after creation. 
data.frame of mean/sum scores with NA
for any row with the
frequency of observed values less than (or equal to) ov.min
. The
colnames are specified by names(vrb.nm.list)
and rownames by
row.names(data)
.
score
rowMeans_if
rowSums_if
scoreItems
1 2 3 4 5 6 7  list_colnames < list("first" = c("rating","complaints","privileges"),
"second" = c("learning","raises","critical"))
scores(data = attitude, vrb.nm.list = list_colnames)
list_colnames < list("first" = c("Ozone","Wind"),
"second" = c("Solar.R","Temp"))
scores(data = airquality, vrb.nm.list = list_colnames, ov.min = .50,
inclusive = FALSE) # scoring conditional on observed values

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.