Learn R Programming

sjmisc (version 2.3.0)

descr: Basic descriptive statistics

Description

This function wraps the describe-function and prints a basic descriptive statistic, including variable labels.

Usage

descr(x, ...)

Arguments

x
A vector or a data frame. May also be a grouped data frame (see 'Note' and 'Examples').
...
Optional, unquoted names of variables. Required, if x is a data frame (and no vector) and only selected variables from x should be processed. You may also use functions like : or dplyr's select_helpers. The latter must be stated as formula (i.e. beginning with ~). See 'Examples' or package-vignette.

Value

A data frame with basic descriptive statistics, derived from the describe-function.

Examples

Run this code
data(efc)
descr(efc, e17age, c160age)

library(dplyr)
efc %>% select(e42dep, e15relat, c172code) %>% descr()

# with grouped data frames
efc %>%
  group_by(e16sex) %>%
  select(e16sex, e42dep, e15relat, c172code) %>%
  descr()

efc %>%
  group_by(e16sex, c172code) %>%
  select(e16sex, c172code, e17age, c160age) %>%
  descr()

Run the code above in your browser using DataLab