View source: R/wilcox_test_report.R
wilcox_test_report | R Documentation |
Print Wilcoxon Rank Sum and Signed Rank Tests reprot
wilcox_test_report(
data,
treatment_col,
value_col,
paired = FALSE,
subject_col = NULL,
report = TRUE
)
data |
Data frame containing the treatment, value and other information. |
treatment_col |
Numeric indicating where treatment locates (column number) in data. |
value_col |
Numeric indicating where treatment value (column number) in data. |
paired |
Logical indicating whether you want a paired test. |
subject_col |
Only meaningful when Pair is ture. Numeric indicating where subject of treatment (column number) in data. |
report |
Logical. If print report to console. Default:TRUE |
wilcox_test_report returns data frame of basic data description.
{
# Data preparation
testdata <- data.frame(
treatment = c(rep("A", 6), rep("B", 6)),
subject = rep(1:6, 2),
value = c(rnorm(6, 2), rnorm(6, 1))
)
# Wilcoxon test (unpaired)
wilcox_result <- wilcox_test_report(
data = testdata,
treatment_col = 1,
value_col = 3
)
# Wilcoxon signed rank test (paired)
wilcox_result <- wilcox_test_report(
data = testdata,
treatment_col = 1,
value_col = 3,
paired = TRUE,
subject_col = 2
)
### Basic data description ###
print(wilcox_result)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.