Learn R Programming

translateSPSS2R (version 1.0.0)

xpssDescriptives: Simple descriptive statistics

Description

R Implementation of the SPSS Function Descriptives

Usage

xpssDescriptives(x, variables, missing = "variable", statistics = c("mean", "max", "min", "stddev"), save = FALSE, ztrans = list(varname = NULL, zname  = NULL))

Arguments

x
a (non-empty) data.frame or input data of class "xpssFrame".
variables
atomic character or character vector with the name of the variables.
missing
atomic character which specifiy the missing method. The method indicates what should happen when the data contains NAs. Default is "variable".
statistics
atomic chracter or character vector which determine the descriptiv statistics. Default are "mean", "max", "min", "stddev".
save
logical indicator. TRUE adds the z-score of each variable to x. Default is FALSE.
ztrans
list which specifies variables for z-transformation and name of z-transformed variables. Read Details for further information.

Value

Output is a list object with descriptive statistic parameters. The specific outcomes of the selected variables are stored in a list object. Every variable is stored in a different list element.If the parameter save is TRUE, a matrix with z-transformed values will be appended at the end of the list. If ztrans is blank, the name of the matrix will be Z*varname*. Otherwise whether ztrans is not empty the user specified description in zname will be the name of the z-transformed matrix of the variable varname.

Details

The xpssDescriptives function provides a set of descriptive statistic tools.

missing:

variable removes user-, and system-missing data explicitly for every variable. listwise performs a listwise-deletion.

statistics:

kurtosis calculates the bulge of the variable. max displays the maximum of the variable. mean calculates the arithmetic mean, respectively the midpoint of the variable. min displays the minimum of the variable. kurtosis calculates the bulge of the variable. range displays the span between the minimum and the maximum value. sekurtosis calculates the standrard error of the bulge of the variable. semean displays the standard error of the arithmetic mean. seskewness calculates the standrard error of the inclination of the variable. skewness calculates the inclination of the variable. stddev displays the standard deviation of the variable. sum calculates the sum of each observation within the variable.

ztrans input, is a list with elements varname and zname. varname and zname are either atomic characters or character vectors. It is necessary that either both parameters are filled or blank.

Examples

Run this code
data(fromXPSS)

## Analyzing Variable V5, Output contains default statistics
xpssDescriptives(x=fromXPSS,
                 variables="V5")

## Analyzing Variable V7_1, Output contains default statistics
## and z-score of Variable V7_1
xpssDescriptives(x=fromXPSS,
                 variables="V7_1",
                 save = TRUE)

## Analyzing Variable V7_2, Output contains default statistics
## and z-score of Variable V7_2 store in myZname
xpssDescriptives(x=fromXPSS,
                 variables="V7_2",
                 save = TRUE,
                 ztrans = list(varname = "V7_2",
                               zname = "myZname"))

 ## Analyzing Variable V7_2, Output contains kurtosis, skewness, semean and mean
 ## missing values are included
 ## z-score get calculated and store in myZname

  xpssDescriptives(x=fromXPSS,
                 variables="V7_2",
                 statistics=c("kurtosis",
                               "skewness",
                               "semean",
                               "mean"),
                 missing="include",
                 save = TRUE,
                 ztrans = list(varname = "V7_2",
                               zname = "myZname"))

Run the code above in your browser using DataLab