Generate standard error of mean

df_sem(data, x)

Arguments

data

A data frame, generally grouped by the intended sub-groups which you want to compare for the same t-test.

x

A (bare) column name of the variable which you want to get the mean, sd, and standard error of the mean (SEM).

Value

A data.frame with consisting of characters. The columns that are always present are: group variable(s), mean, sd, n, and se(SEM).

Examples

df_sem(color_index, color_index)
#> Warning: The `df_sem()` function expects a grouped data frame (i.e., from `dplyr::group_by()`). Returning the overall mean, sd, n and se.
#> # A tibble: 1 x 4 #> mean_color_index sd n se #> <dbl> <dbl> <int> <dbl> #> 1 0.0120 0.0413 232 0.00271
library(magrittr) color_index %>% df_sem(color_index)
#> Warning: The `df_sem()` function expects a grouped data frame (i.e., from `dplyr::group_by()`). Returning the overall mean, sd, n and se.
#> # A tibble: 1 x 4 #> mean_color_index sd n se #> <dbl> <dbl> <int> <dbl> #> 1 0.0120 0.0413 232 0.00271