Description Usage Arguments Value See Also Examples
View source: R/test_normality.R
Perform a test of normality for each group separately. The available tests: Shapiro-Wilk (default), Lilliefors (Kolmogorov-Smirnov), Anderson-Darling and other.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | test_normality(
  y,
  data = NULL,
  test = "Shapiro-Wilk",
  p_adjust_method = NULL,
  ...,
  groups = NULL,
  ss = signif_syms,
  hide_error_msg = FALSE
)
## S3 method for class 'test_normality'
print(
  x,
  ...,
  digits_p = 3,
  signif_stars = !is.null(ss),
  digits_stat = 3,
  format_stat = c("auto", "f", "g"),
  rm_zero = FALSE,
  legend = TRUE,
  show_col_method = FALSE,
  hide_error_msg = attr(x, "hide_error_msg"),
  ss = attr(x, "ss")
)
## S3 method for class 'test_normality'
pander(
  x,
  caption = NA,
  ...,
  digits_p = 3,
  signif_stars = !is.null(ss),
  digits_stat = 3,
  format_stat = c("auto", "f", "g"),
  rm_zero = FALSE,
  legend = TRUE,
  show_col_method = FALSE,
  hide_error_msg = attr(x, "hide_error_msg"),
  ss = attr(x, "ss")
)
 | 
| y | (formula|numeric|character) 
 | 
| data | (data frame| | 
| test | (string | function)  
 | 
| p_adjust_method | ( | 
| ... | Further parameters to the function of normatity test. | 
| groups | ( | 
| ss | 
 | 
| hide_error_msg | (logical)  | 
| x | 
 | 
| digits_p | (numeric) Number of significant digits to round a p value to. No less than 2. 
 | 
| signif_stars | (logical)  | 
| digits_stat | (integer)   | 
| format_stat | (character)  | 
| rm_zero | (logical) Flag if leading zero before the point should be removed. | 
| legend | (logical)  | 
| show_col_method | (logical)  | 
| caption | (string| | 
 Function test_normality returns a data frame with
normality test results for each group.
print and pander methods format and print the
results. By default, methods print.test_normality and
pander.test_normality do not print column called "method".
stats::shapiro.test() in package stats;
nortest::lillie.test() in package nortest;
nortest::pearson.test() in package nortest;
nortest::ad.test() in package nortest;
nortest::cvm.test() in package nortest;
nortest::sf.test() in package nortest.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | library(biostat)
library(pander)
data(CO2)
# For whole dataset
test_normality(~uptake, data = CO2)
# For each subgroup
test_normality(uptake ~ Treatment, data = CO2)
# For each subgroup by several factor variables
rez <- test_normality(uptake ~ Type + Treatment,
                      data = CO2)
rez
# Modify printed output
print(rez, rm_zero = TRUE)
print(rez, digits_p = 2)
# Choose another test of normality
rez2 <- test_normality(uptake ~ Type + Treatment,
                      data = CO2,
                      test = "chi-sq")
rez2
# Print as a 'pandoc' table (for R Markdown reports)
pander(rez)
pander(rez, digits_stat = 2)
pander(rez, digits_p = 2)
pander(rez, digits_p = 4, signif_stars = FALSE)
## Not run: 
# View unformatted results in a separate window
View(rez)
## End(Not run)
# Show object's class
class(rez)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.