Means and standard deviations by group variable formatted in table

mean_sd_tab(features, groups, decimals = 2, na.rm = FALSE, return_diff = FALSE)

Arguments

features

A data frame of features

groups

A grouping vector

decimals

The number of decimals

na.rm

Should NAs be removed prior to computing stats (Default = FALSE)

return_diff

Boolean. Should an additional row be printed that contains the difference between minimum and maximum

Value

A table that illustrates means and standard deviations (in brackets)

Author

Martin Papenberg martin.papenberg@hhu.de

Examples


data(iris)
mean_sd_tab(iris[, -5], iris[, 5])
#>            Sepal.Length  Sepal.Width   Petal.Length  Petal.Width  
#> setosa     "5.01 (0.35)" "3.43 (0.38)" "1.46 (0.17)" "0.25 (0.11)"
#> versicolor "5.94 (0.52)" "2.77 (0.31)" "4.26 (0.47)" "1.33 (0.20)"
#> virginica  "6.59 (0.64)" "2.97 (0.32)" "5.55 (0.55)" "2.03 (0.27)"