nt_compare_tg: Compare two groups

View source: R/compare_groups.R

nt_compare_tgR Documentation

Compare two groups

Description

Performing comparisons between two groups.

Usage

nt_compare_tg(
  data,
  group,
  labels = NULL,
  alternative = "two.sided",
  norm.test = helper_sf_test,
  var.test = helper_levene_test,
  qt.test = list(helper_student_t, helper_welch_t, helper_mann_whitney,
    helper_brunner_munzel),
  paired = FALSE,
  conf.level = 0.95,
  format = TRUE,
  digits.ci = 3,
  digits.p = 5,
  save = FALSE,
  file = "nt_compare_tg",
  ...
)

Arguments

data

a data frame with the variables.

group

a data frame with the group variable.

labels

a list of labels with components given by their variable names.

alternative

a character value indicating the alternative hypothesis, must be one of "two.sided", "greater" or "less".

norm.test

a function with a numeric vector as input and a list as output containing an object named p.value similar to helper_sf_test.

var.test

a function with a numeric vector, group vector and paired logical variable as input and a list as output containing an object named p.value similar to helper_levene_test.

qt.test

a list of functions for four possible cases: (1) normality and homoscedasticity, (2) normality and heteroscedasticity, (3) non-normality and homoscedasticity and (4) normality and heteroscedasticity.

paired

a logical value indicating whether a paired test should be used.

conf.level

a character value specifying the confidence level of the confidence interval for the difference between the two groups.

format

a logical value indicating whether the output should be formatted.

digits.ci

the number of digits to present the confidence intervals.

digits.p

the number of digits to present the p-values.

save

a logical value indicating whether the output should be saved as a csv file.

file

a character value indicating the name of output file in csv format to be saved.

...

a list with additional arguments to be passed to the helper functions.

Examples

data(iris)
library(dplyr)

iris |> filter(Species != "setosa") |>
 mutate(Species = droplevels(Species)) |>
 nt_compare_tg(group = Species,
               labels = list(Sepal.Length = "Sepal Length",
                             Sepal.Width = "Sepal Width",
                             Petal.Length = "Petal Length",
                             Petal.Width = "Petal Width"))

dnzmarcio/ntimes documentation built on Jan. 4, 2024, 2:23 p.m.