Learn R Programming

jmv (version 0.7.3.1)

descriptives: Descriptives

Description

Provides a range of descriptive statistics

Usage

descriptives(data, vars, mean = TRUE, median = TRUE, mode = FALSE,
  sum = FALSE, sd = FALSE, variance = FALSE, range = FALSE,
  min = TRUE, max = TRUE, se = FALSE, skew = FALSE, kurt = FALSE,
  freq = FALSE, plots = FALSE, plotW = 480, plotH = 320,
  quart = FALSE, pcEqGr = FALSE, pcNEqGr = 4)

Arguments

data

the data as a data frame

vars

a vector of strings naming the variables of interest in data

mean

TRUE (default) or FALSE, provide the mean

median

TRUE (default) or FALSE, provide the median

mode

TRUE or FALSE (default), provide the mode

sum

TRUE or FALSE (default), provide the sum

sd

TRUE or FALSE (default), provide the standard deviation

variance

TRUE or FALSE (default), provide the variance

range

TRUE or FALSE (default), provide the range

min

TRUE or FALSE (default), provide the minimum

max

TRUE or FALSE (default), provide the maximum

se

TRUE or FALSE (default), provide the standard error

skew

TRUE or FALSE (default), provide the skewness

kurt

TRUE or FALSE (default), provide the kurtosis

freq

TRUE or FALSE (default), provide frequency tables (nominal, ordinal variables only)

plots

TRUE or FALSE (default), provide frequency tables (nominal, ordinal variables only)

plotW

an integer (default: 480) specifying the width of the plots

plotH

an integer (default: 320) specifying the height of the plots

quart

TRUE or FALSE (default), provide quartiles

pcEqGr

TRUE or FALSE (default), provide quantiles

pcNEqGr

an integer (default: 4) specifying the number of equal groups

Examples

Run this code

data('mtcars')
dat <- mtcars

# frequency tables can be provided for factors
dat$gear <- as.factor(dat$gear)

descriptives(dat, vars = c('mpg', 'cyl', 'disp', 'gear'), freq = TRUE)

#
#  Descriptives
#
#  Descriptives
#  -------------------------------------------
#               mpg     cyl     disp    gear
#  -------------------------------------------
#    N            32      32      32      32
#    Missing       0       0       0       0
#    Mean       20.1    6.19     231
#    Median     19.2    6.00     196
#    Minimum    10.4    4.00    71.1
#    Maximum    33.9    8.00     472
#  -------------------------------------------
#
#
#  Frequencies
#
#  Frequencies of gear
#  -------------------------------------------
#    Level    Counts    %       Cumulative %
#  -------------------------------------------
#    3            15    46.9            46.9
#    4            12    37.5            84.4
#    5             5    15.6           100.0
#  -------------------------------------------
#

Run the code above in your browser using DataLab