dif_prep | R Documentation |
DIFreport
functions.Data pre-processing to gather information and prepare data for use in other DIFreport
functions.
dif_prep(
data,
dif.groups,
ref.name = NULL,
items = names(data),
anchors = NULL,
poly.items = NULL,
max.values = NULL,
cond.groups = NULL,
cluster = NULL,
na.to.0 = FALSE
)
data |
a |
dif.groups |
column position or name in |
ref.name |
character; specifying the reference group in |
items |
vector of column positions or names in |
anchors |
vector of column positions or names |
poly.items |
vector of column positions or names |
max.values |
the maximum value each item in |
cond.groups |
column name or number in |
cluster |
column name or number in |
na.to.0 |
After removing empty rows, should remaining NAs in |
This function saves the input data in a format used by other DIFreport
functions and also runs a number of pre-processing steps:
Drops rows in data
with NA
for all items
columns, dif.groups
, cond.groups
(if specified), or cluster
(if specified).
Converts dif.groups
and to a factor
and confirms there are only two groups. Same for cond.groups
if specified.
Flag items with no variance.
Flag items with different number of response categories across the dif.groups
.
Identify items with more than two response categories (i.e., polytomous items).
It is recommended, but not required, that responses for each item are coded as consecutive integers with a minimum value of 0 (e.g., 0, 1, 2).
A named list
containing the pre-processed inputs and item flags.
data("mdat")
dif.data <- dif_prep(data = mdat,
dif.groups = "treated",
ref.name = "Control",
items = 5:ncol(mdat)
cond.groups ="gender",
cluster = "clusterid",
na.to.0 = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.