missTally | R Documentation |
This is a handy helper function that can be used in PRO scoring
functions to determine the number (or proportion) of item responses that
are missing (or valid) for each row in a data frame of items. This is used
by scoreScale
to help determine if a respondent has answered enough
items to be assigned a prorated scale score.
missTally(dfItems, what = c("pmiss", "nmiss", "pvalid", "nvalid"))
dfItems |
A data frame containing only the items of interest. |
what |
One of four quoted names indicating the value you want for each
respondent (row) in |
A vector of length nrow(dfItems)
that contains the quantity
requested in what
for each row of dfItems
.
set.seed(8675309)
# Make data frame with 10 respondents, 10 items, and approx 30% missing data
(myItems <- makeFakeData(n = 10, nitems = 10, propmiss = .30))
# The default is to return "pmiss", the proportion missing for each row.
missTally(myItems)
missTally(myItems, "pvalid")
missTally(myItems, "nmiss")
missTally(myItems, "nvalid")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.