descript | R Documentation |
This function computes summary statistics for one or more than one variable, optionally by a grouping and/or split variable.
descript(data, ...,
print = c("all", "default", "n", "nNA", "pNA", "m", "se.m", "var", "sd",
"min", "p25", "med", "p75", "max", "range", "iqr", "skew", "kurt"),
group = NULL, split = NULL, sample = FALSE, sort.var = FALSE,
na.omit = FALSE, digits = 2, as.na = NULL, write = NULL, append = TRUE,
check = TRUE, output = TRUE)
data |
a numeric vector or data frame with numeric variables,
i.e., factors and character variables are excluded from
|
... |
an expression indicating the variable names in |
print |
a character vector indicating which statistical measures to be
printed on the console, i.e. |
group |
a numeric vector, character vector or factor as grouping variable.
Alternatively, a character string indicating the variable name
of the grouping variable in |
split |
a numeric vector, character vector or factor as split variable.
Alternatively, a character string indicating the variable name
of the split variable in |
sample |
logical: if |
sort.var |
logical: if |
na.omit |
logical: if |
digits |
an integer value indicating the number of decimal places to be used. |
as.na |
a numeric vector indicating user-defined missing values,
i.e. these values are converted to |
write |
a character string naming a file for writing the output into
either a text file with file extension |
append |
logical: if |
check |
logical: if |
output |
logical: if |
Returns an object of class misty.object
, which is a list with following
entries:
call |
function call |
type |
type of analysis |
data |
list with the input specified in |
args |
specification of function arguments |
result |
result table |
Takuya Yanagida takuya.yanagida@univie.ac.at
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. John Wiley & Sons.
ci.mean
, ci.mean.diff
, ci.median
,
ci.prop
, ci.prop.diff
, ci.var
,
ci.sd
, freq
, crosstab
,
multilevel.descript
, na.descript
.
#----------------------------------------------------------------------------
# Descriptive statistics
# Example 1a: Descriptive statistics for 'mpg', 'cyl', and 'hp'
descript(mtcars, mpg, cyl, hp)
# Alternative specification without using the '...' argument
descript(mtcars[, c("mpg", "cyl", "hp")])
# Example 1b: Print all available statistical measures
descript(mtcars, mpg, cyl, hp, print = "all")
# Example 1c: Print default statistical measures plus median
descript(mtcars, mpg, cyl, hp, print = c("default", "med"))
#----------------------------------------------------------------------------
# Grouping and Split Variable
# Example 2a: Grouping variable
descript(mtcars, mpg, cyl, hp, group = "vs")
# Alternative specification without using the '...' argument
descript(mtcars[, c("mpg", "cyl", "hp")], group = mtcars$vs)
# Example 2b: Split variable
descript(mtcars, mpg, cyl, hp, split = "am")
# Alternative specification without using the '...' argument
descript(mtcars[, c("mpg", "cyl", "hp")], split = mtcars$am)
# Example 2c: Grouping and split variable
descript(mtcars, mpg, cyl, hp, group = "vs", split = "am")
# Alternative specification without using the '...' argument
descript(mtcars[, c("mpg", "cyl", "hp")], group = mtcars$vs, split = mtcars$am)
#----------------------------------------------------------------------------
# Write Output
## Not run:
# Example 3a: Text file
descript(mtcars, write = "Descript_Text.txt")
# Example 3b: Excel file
descript(mtcars, write = "Descript_Excel.xlsx")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.