This function performs a Shapiro-Wilk normality test on multiple variables in a dataframe by groups.
Details
The function first creates subsets of the data for each group. It then performs a Shapiro-Wilk normality test (`shapiro.test()`) on each group and returns the results in a tidy format. the function also checks whether the number of observations for each variable and group lies within the permissible range of the `shapiro.test()`. If not, the function will provide diagnostics on why a test could not be performed base on which groups are affected.
Examples
if (FALSE) { # \dontrun{
# Perform a normality test for groups
ntest_by(df = mtcars,
cols = mpg,
group = cyl)
# Perform a normality test for multiple variables by groups
ntest_by(df = starwars,
cols = c(mass, birth_year),
group = species)
} # }