Learn R Programming

stripless (version 1.0-1)

print.structured: Methods for Structured Objects

Description

Print/plot and summary methods for class 'structured' objects.

Usage

"print"(x, legendLoc = c("left", "right", "top", "bottom", "newpage"), legend = defaultStrucLegend, abbrevLength = 0, ...)
"plot"(...)
"summary"(object, ...)
"print"(x, ...)

Arguments

x, object
The object to be displayed or summarized.
legendLoc
An optional location of a legend describing the plot layout to be used as a legend on the trellis plot. Note that a text legend is always printed on the console. If used, this argument specified the position of a legend in the trellis display. It must be one of "left", "right", "top", "bottom", or "newpage" (matching is done using match.arg, so legendLoc can be abbreviated). Any of the first four of these will become the name of a component of the legend argument of the xyplot call, and so must not conflict with any in a legend argument that may already be part of the strucplot call.

If legendLoc = "newpage", the legend will be plotted centered on a new trellis page.

legend
A function that constructs a grob to use as a plot legend. It must accept at least 2 arguments, "struc" and "legendLoc", which will be passed the "structure" attribute of the object to be plotted and the legendLoc argument above. Additional arguments may be passed in the ... argument of the print call (below).

The default is the unexported defaultStrucLegend function. Its Help file should be consulted for its full argument list.

abbrevLength
Default = 0. A non-zero value of this argument is used as the minlength argument of the abbreviate function to abbreviate the names of the conditioning factors both in the automatically generated console legend and the optional plot legend.
...
Further arguments to pass down to either the legend function or print.trellis, which should be consulted for details. Care should be taken to ensure that the names of arguments do not coincide. See defaultStrucLegend for arguments for the default legend function.

Details

The print and plot methods produce a plot and informative legend for "structured" objects. The plot method is an alias for the print method. The summary method gives a simple summary of the object.

See Also

print.trellis

Examples

Run this code
require(datasets)
# quakes data
#
# Create and save plot
out <- strucplot(lat ~ long|cut(mag,5)*cut(depth,4), data = quakes,
  col="blue", main = "Earthquake locations, by magnitude and depth")

# Summary:
summary(out)

# Default output -- structure legend on console only
   print(out)

# Add legends to the plot on either right or bottom (note partial matching)
   print(out, legendLoc = "right")
   print(out, legendLoc = "b")
#
# Abbreviate the conditioning factor names
   print(out, legendLoc = "b", abbrev = 5)
#
# Plot the legend by itself on a separate page
   print(out, legendLoc = "newp")
#
# Extra grid "gp" arguments to alter text appearance
   print(out, legendLoc = "b",col="blue",fontface = "italic",
   abbrev = 5)

Run the code above in your browser using DataLab