Defines missing values for variables.
R implementation of the SPSS
MISSING VALUES function. xpssMissingValues defines values as missing and replaces them with
NA. Position and Value are stored in the attributes of the specific variables.
1 2 3
a (non-empty) data.frame, data.table object or input data of class
atomic character or character vector with the names of the variables.
numeric list containing range and singlevalues.
logical. Indicating, if the existing missings should get overwritten or not.
numeric vector containing a missing range from i to n.
atomic numeric or numeric vectors containing singlevalues which determine missing values.
xpssMissingValues specifies values for missing data for the selected variables. Those variables which match the terms of beeing a missing data get treated as
NA. In most cases, variables which contain
NA receive a special treatment in data management, case selection, and descriptive, respectively inductive statistics.
User-missing values and system-missing values get treated as exactly one kind of missing data. The only difference in those missing values are that system missings get automatically assigned by the program when no legal value can be produced (e.g. character input at a numeric varibale, failed datatransformation) and user-defined missings, which are missing user data (e.g. the respondent forgot to answer, or skipped the question).
Common is that this empty spaces are filled with -9 till -999 (for e.g. refusal to respond, inability to respond, Non-contact).
as.missing statement indicates the handling of values which are matched by the as.missing statement. Input format is a list with the arguments
range to determine a range of values with the arguments
to as NA or
singlevalues to specify one more singlevalues as missing.
NOTE: The special arguments
hi can be used to determine the lowest and highest value of a numeric value, wheter a missing
range gets indexed.
xpssFrame object with
NAs located at the position where the specified values in as.missing used to be. In the attributes of the object the position and the value itself is stored.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
data(fromXPSS) fromXPSS <- xpssMissingValues(fromXPSS, variables = "V6", as.missing = list(range=c(from="lo", to=45))) fromXPSS <- xpssMissingValues(fromXPSS, variables = "V3", as.missing = list(singlevalues=c(1, 2))) fromXPSS <- xpssMissingValues(fromXPSS, variables = "V6", as.missing = list(singlevalues="lo", range=c(from="50", to="hi")))