Learn R Programming

factorplot (version 1.3)

plot.factorplot: Plot method for objects of class factorplot

Description

Creates a plot akin to an upper-triangular levelplot (though using plot rather than levelplot) where the coloring of the squares represents significance and text inside the squares represents the pairwise difference and its correspopnding standard error.

Usage

# S3 method for factorplot
plot(
  x,
  ...,
  abbrev.char = 100,
  print.est = TRUE,
  print.se = TRUE,
  text.nudge = 0.1,
  text.args = list(),
  remove.caption = FALSE
)

Value

a graph

For m categories, the plot returns an m-1 x m-1 matrix where the nexus of the row and column values represent the pairwise differences between the row and column values along with the standard error of the difference on the linear scale (unless a transformation is performed).

Arguments

x

An object of class factorplot, produced by factorplot.

...

Other arguments to be passed to plot, currently not implemented

abbrev.char

The number of characters that should be used to abbreviate the levels of the factor. Set to a large value for unabbreviated names.

print.est

logical argument indicating whether the estimates should be printed in the boxes

print.se

logical argument indicating whether the standard errors should be printed in the boxes

text.nudge

Scalar giving the value the estimate text will be moved in the positive direction on y and the standard error text will be moved in the negative direction on y.

text.args

A list of other arguments to be passed to `geom_text()`, such as `size` or `color`.

remove.caption

Logical indicating whether the caption should be removed from the plot.

Author

Dave Armstrong

See Also

factorplot

Examples

Run this code

est1 <- log(c(1.00,2.12,1.44,1.31,1.44,
     1.46,0.90))
var1 <- c(0.242,0.096,0.156,0.140,
     0.380,0.484,0.375)^2
names(est1) <- c(
     "Normal & superficial gastritis", 
     "Chronic gastritis", 
     "Chronic atrophic gastritits", 
     "Intestinal metaplasia I", 
     "Intestinal metaplasia II", 
     "Intestinal metaplasia III", 
     "Dysplasia")

plummer_fp1 <- factorplot(est1, var=var1, resdf=Inf)
plot(plummer_fp1, trans="exp", abbrev.char = 100)

Run the code above in your browser using DataLab