Skip to contents

This function generates a summary table for a data frame, containing summary statistics for each variable in the data frame.

Usage

describe(data, digits = 4, t = TRUE, flextable = FALSE, ft_args = list(), ...)

Arguments

data

A data frame containing the data to be summarized

digits

The number of 0digits to display in the summary table (default is 4)

t

If TRUE, the table will be transposed (default is TRUE)

flextable

If TRUE, the table will be converted to a simple flextable (default is FALSE)

ft_args

A list of additional arguments to pass to the flextable function if flextable = TRUE (default is an empty list)

...

Other arguments to pass to the summary function

Value

A table containing summary statistics for each variable in the data frame

Examples

# Using summary
summary(cars)
#>      speed           dist       
#>  Min.   : 4.0   Min.   :  2.00  
#>  1st Qu.:12.0   1st Qu.: 26.00  
#>  Median :15.0   Median : 36.00  
#>  Mean   :15.4   Mean   : 42.98  
#>  3rd Qu.:19.0   3rd Qu.: 56.00  
#>  Max.   :25.0   Max.   :120.00  

# Using describe
describe(cars)
#>         speed   dist
#> Min.      4.0   2.00
#> 1st Qu.  12.0  26.00
#> Median   15.0  36.00
#> Mean     15.4  42.98
#> 3rd Qu.  19.0  56.00
#> Max.     25.0 120.00
describe(cars, flextable = TRUE)

speed

dist

Min.

4.0

2.00

1st Qu.

12.0

26.00

Median

15.0

36.00

Mean

15.4

42.98

3rd Qu.

19.0

56.00

Max.

25.0

120.00