plot.htest: Plots htest objects

Description Usage Arguments See Also Examples

View source: R/plot-htest.R

Description

Adds htest objects to existing plots.

Usage

1
2
3
## S3 method for class 'htest'
plot(x, legend_pos = "topleft", digits = 4L, bty = "n",
  n_char = 45, exdent = 4, ...)

Arguments

x

an object of class htest.

legend_pos

a position of the text on the plot. Either matrix or a single keyword. See Details section of legend.

digits

number of digits.

bty

the type of box to be drawn around the plotted test. The allowed values are "o" (border around plotted test information) and "n" (no border; the default).

n_char

integer representing maximum number of character in single line of the output.

...

additional arguments sent to legend.

extend

a non-negative integer specifying the indentation of subsequent lines in paragraphs.

See Also

undocumented stats:::print.htest function - printing test summary.

legend - responsible for adding test summary to plots.

strwrap - splits longer lines on whitespaces.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#Example 1: test for correlation between paired samples
x <- 1:20
y <- exp(x)
sample_cortest <- cor.test(x, y)
plot(x, y, type = "b")
plot(sample_cortest, "topleft")

#Example 2: Pearson's Chi-squared Test for Count Data
x <- matrix(c(12, 5, 7, 7), ncol = 2)
sample_chisqtest <- chisq.test(x, y)
barplot(x, beside = TRUE)
plot(sample_chisqtest, "topright")

michbur/plotest documentation built on May 22, 2019, 9:54 p.m.