Learn R Programming

JWileymisc (version 1.4.1)

styletests: Several internal functions to style inference tests

Description

Several internal functions to style inference tests

Usage

.styleaov(dv, g, digits = 2L, pdigits = 3L)

.style2sttest(dv, g, digits = 2, pdigits = 3)

.stylepairedttest(dv, g, ID, digits = 2, pdigits = 3)

.stylepairedwilcox(dv, g, ID, digits = 2, pdigits = 3)

.stylepairedmcnemar(dv, g, ID, digits = 2, pdigits = 3)

.stylekruskal(dv, g, digits = 2, pdigits = 3)

.stylechisq(dv, g, digits = 2, pdigits = 3, simChisq = FALSE, sims = 10000)

.stylemsd(n, x, digits = 2, includeLabel = FALSE)

.stylemdniqr(n, x, digits = 2, includeLabel = FALSE)

.stylefreq(n, x)

Value

A character string of the formatted results.

Arguments

dv

An outcome variable

g

A grouping/predictor variable

digits

An integer indicating the number of significant digits to use. Defaults to 2.

pdigits

An integer indicating the number of digits for p values. Defaults to 3.

simChisq

A logical value, whether or not to simulate chi-square values. Only applies to some functions. Defaults to FALSE.

sims

An integer indicating the number of simulations to conduct. Only applies to some functions. Defaults to 10000, but this is arbitrary and should be chosen.

Examples

Run this code

JWileymisc:::.styleaov(mtcars$mpg, mtcars$cyl)

JWileymisc:::.style2sttest(mtcars$mpg, mtcars$am)

JWileymisc:::.stylepairedttest(sleep$extra, sleep$group, sleep$ID)

JWileymisc:::.stylepairedwilcox(sleep$extra, sleep$group, sleep$ID)

## example data
set.seed(1234)
exdata <- data.frame(
  ID = rep(1:10, 2),
  Time = rep(c("base", "post"), each = 10),
  Rating = sample(c("good", "bad"), size = 20, replace = TRUE))
JWileymisc:::.stylepairedmcnemar(exdata$Rating, exdata$Time, exdata$ID)
rm(exdata) ## cleanup

JWileymisc:::.stylekruskal(mtcars$mpg, mtcars$am)
JWileymisc:::.stylekruskal(mtcars$mpg, mtcars$cyl)

JWileymisc:::.stylechisq(mtcars$cyl, mtcars$am)

JWileymisc:::.stylemsd("Miles per Gallon", mtcars$mpg)
JWileymisc:::.stylemsd("Miles per Gallon", mtcars$mpg, includeLabel = TRUE)

JWileymisc:::.stylemdniqr("Miles per Gallon", mtcars$mpg)
JWileymisc:::.stylemdniqr("Miles per Gallon", mtcars$mpg, includeLabel = TRUE)

JWileymisc:::.stylefreq("Transmission", mtcars$am)
JWileymisc:::.stylefreq("Transmission", mtcars$am)

Run the code above in your browser using DataLab