Function for generating a data.frame with averages or other descriptive measures grouped by a categorical variable

tabledesc(data, fun = mean)

Arguments

data

data.frame containing the first column with the categorical variable and the remaining response columns

fun

Function of descriptive statistics (default is mean)

Value

Returns a data.frame with a measure of dispersion or position from a dataset and separated by a factor

Author

Gabriel Danilo Shimizu, shimizu@uel.br

Leandro Simoes Azeredo Goncalves

Rodrigo Yudi Palhaci Marubayashi

Examples

data(pomegranate)
tabledesc(pomegranate)
#>        WL     SS    AT    ratio
#> T1 1.8425 14.225 0.900 16.23341
#> T2 1.6775 14.275 0.900 16.73232
#> T3 2.6175 15.000 0.975 15.48409
#> T4 2.6200 14.050 1.050 13.66667
#> T5 2.6375 14.350 1.075 13.50821
#> T6 2.1625 14.650 1.025 14.47664
library(knitr)
kable(tabledesc(pomegranate))
#>        WL     SS    AT    ratio
#> T1 1.8425 14.225 0.900 16.23341
#> T2 1.6775 14.275 0.900 16.73232
#> T3 2.6175 15.000 0.975 15.48409
#> T4 2.6200 14.050 1.050 13.66667
#> T5 2.6375 14.350 1.075 13.50821
#> T6 2.1625 14.650 1.025 14.47664
#> 
#> 
#> |   |     WL|     SS|    AT|    ratio|
#> |:--|------:|------:|-----:|--------:|
#> |T1 | 1.8425| 14.225| 0.900| 16.23341|
#> |T2 | 1.6775| 14.275| 0.900| 16.73232|
#> |T3 | 2.6175| 15.000| 0.975| 15.48409|
#> |T4 | 2.6200| 14.050| 1.050| 13.66667|
#> |T5 | 2.6375| 14.350| 1.075| 13.50821|
#> |T6 | 2.1625| 14.650| 1.025| 14.47664|