View source: R/t_test_report.R
t_test_report | R Documentation |
Print Student's t-Test report
t_test_report(
data,
treatment_col,
value_col,
paired,
subject_col,
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 t-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 |
t_test_report returns list containing:
data frame of basic data descrption
results of student's t-Test
{
### Data preparation ###
testdata <- data.frame(
treatment = c(rep("A", 6), rep("B", 6)),
subject = rep(c(1:6), 2),
value = c(rnorm(6, 2), rnorm(6, 1))
)
# Perform t-test (unpaired)
t_test_result <- t_test_report(
data = testdata,
treatment_col = 1,
value_col = 3
)
# Perform paired t-test
t_test_result <- t_test_report(
data = testdata,
treatment_col = 1,
value_col = 3,
paired = TRUE,
subject_col = 2
)
### Basic data description ###
print(t_test_result[[1]])
print(t_test_result$basicdata)
### T-test results ###
print(t_test_result[[2]])
print(t_test_result$t.test_results)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.