style.apa.fisher: Formats a Fisher's Exact Test

Description Usage Arguments Details Value See Also Examples

View source: R/style_apa.R

Description

This style functions takes a Fisher's exact test in a list and transforms it into a formatted character vector. Odds ratio is printed optionally.

Usage

1
2
style.apa.fisher(x, print.estimate = TRUE,
  estimate.names = names(x[[1]]$estimate))

Arguments

x

a list. First item must be a Fisher's exact test (htest class). All other list items will be ignored.

print.estimate

a logical, indicating whether odds ratio is printed as well.

estimate.names

a character vector, giving a alternative name for "odds ratio".

Details

Please note that this is a internal style function. It is called from pprint and not exported to user namespace. Usually pprint determines the correct style function automatically, but you can define the style function by using the format argument of pprint (pass the name of this function without style.apa. prefix). Additionally you can pass the arguments listed in this documentation to pprint.

Argument x of this function expects a list. Be aware that you do not have to pass a list to pprint or pull.pubprint – these functions will convert your arguments. This is only necessary if you want to pass additionally information to the internal style functions (see vignette for examples).

Value

character vector with a formatted character vector.

See Also

fisher.test

Other APA.style.functions: style.apa.anova, style.apa.bartlett, style.apa.character, style.apa.chisq, style.apa.cor.test, style.apa.df, style.apa.ks, style.apa.numeric, style.apa.p.value, style.apa.shapiro, style.apa.summary.aovlist, style.apa.summary.lm.beta.coeff, style.apa.summary.lm.coeff, style.apa.summary.lm.equation, style.apa.summary.lm.model, style.apa.t.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
pprint(t.test(1:30, 2:31), format = "t.test")
pprint(t.test(1:30, 2:31), format = "t.test", print.estimate = FALSE)
pprint(t.test(1:30, 2:31), 
       format = "t.test", 
       estimate.names = c("control", "treatment"))
TeaTasting <-
matrix(c(3, 1, 1, 3),
       nrow = 2,
       dimnames = list(Guess = c("Milk", "Tea"),
                       Truth = c("Milk", "Tea")))
pprint(fisher.test(TeaTasting, alternative = "greater"),
       format = "fisher")
pprint(fisher.test(TeaTasting, alternative = "greater"),
       format = "fisher",
       print.estimate = FALSE)

Example output

[1] "(\\ensuremath{M\\ifmmode_{x}\\else\\textsubscript{x}\\fi=15.50,M\\ifmmode_{y}\\else\\textsubscript{y}\\fi=16.50,t[58]=-0.44,p=.662})"
[1] "(\\ensuremath{t[58]=-0.44,p=.662})"
[1] "(\\ensuremath{control=15.50,treatment=16.50,t[58]=-0.44,p=.662})"
[1] "(\\ensuremath{odds ratio=6.41,p=.243})"
[1] "(\\ensuremath{p=.243})"

pubprint documentation built on May 29, 2017, 2:55 p.m.