xpssMissingValues: Defines missing values for variables.

Description Usage Arguments Details Value Author(s) Examples

View source: R/xpssMissingValues.R

Description

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.

Usage

1
2
3
xpssMissingValues(x, variables = NULL,
as.missing = list(range = c(from=NULL,to=NULL),singlevalues = NULL),
append = FALSE)

Arguments

x

a (non-empty) data.frame, data.table object or input data of class "xpssFrame".

variables

atomic character or character vector with the names of the variables.

as.missing

numeric list containing range and singlevalues.

append

logical. Indicating, if the existing missings should get overwritten or not.

range

numeric vector containing a missing range from i to n.

singlevalues

atomic numeric or numeric vectors containing singlevalues which determine missing values.

Details

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).

The 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 from and to as NA or singlevalues to specify one more singlevalues as missing.

NOTE: The special arguments lo and hi can be used to determine the lowest and highest value of a numeric value, wheter a missing range gets indexed.

Value

a 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.

Author(s)

Andreas Wygrabek

Examples

 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")))

translateSPSS2R documentation built on May 30, 2017, 4:31 a.m.