Each high-level function in lattice is intended to create a certain type of statistical display by default. Many variations are already built into the default panel functions and can be activated with additional arguments in a high-level function call itself. More extensive modifications can be made by writing custom panel functions, as we have seen throughout this book and particularly in Chapter 13.
Although panel functions can be used to implement entirely novel visualizations, trying to shoehorn such a display into a function intended for another purpose is mostly useful as a one-off, quick-and-dirty solution. For a systematic implementation that could perhaps be used by others, it is often more sensible to create a new function whose name better reflects the nature of the visualization. On the other hand, existing function names are sometimes perfectly appropriate, and it is the data which are in a form that is not directly usable. A typical example of this is a univariate time series; there is really only one choice for the x and y variables in the xyplot() call that produced Figure 10.17, and the need for a new function to hide the use of a formula seems wasteful.
Rather than trying to anticipate all potential use cases, lattice provides the groundwork for further extensions by making use of the object-oriented features of R. Each high-level function in lattice is generic, with method dispatch possible on the first argument x and possibly (using the formal S4 system) the second argument data. New high-level display functions can be written either as new methods for existing generic functions, or, if it seems appropriate, as an entirely new function which should itself be generic to allow further specialized methods. In this chapter, we give examples of both new methods and new high-level functions implemented using the framework provided by lattice. These can, it is hoped, serve as models for further extensions.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2008 Springer Science+Business Media, LLC
About this chapter
Cite this chapter
(2008). New Trellis Displays. In: Lattice. Use R!. Springer, New York, NY. https://doi.org/10.1007/978-0-387-75969-2_14
Download citation
DOI: https://doi.org/10.1007/978-0-387-75969-2_14
Publisher Name: Springer, New York, NY
Print ISBN: 978-0-387-75968-5
Online ISBN: 978-0-387-75969-2
eBook Packages: Mathematics and StatisticsMathematics and Statistics (R0)