latticist {latticist} | R Documentation |
Interactively explore a data set using Lattice displays.
latticist(dat, spec = list(), reorder.levels = !is.table(dat), ..., use.playwith = latticist.getOption("use.playwith"))
dat |
a data frame (with numeric and/or categorical variables),
or a table . |
spec |
a list specifying the initial latticist display.
See latticistCompose . |
reorder.levels |
if TRUE , change the ordering of levels of factor
variables so they are in order of frequency. Note that this does not
change the data, only its internal representation: see
reorder . This is recommended for effective graphic
displays. Factor variables of class ordered are not reordered.
Therefore you should ensure that any variables whose levels have an inherent
order are of class ordered : see as.ordered .
Note: the result of cut is by default NOT
ordered !
In addition, numeric variables with discrete values in {0, 1, -1}
are converted to factors.
|
use.playwith |
whether to launch as a toolbar for playwith (requires the
playwith package), or a generic gWidgets interface.
|
... |
further arguments specific to the interface type. For the playwith
interface, these are passed to playwith . For
the gWidgets interface, these are:
|
Latticist is a graphical user interface for exploratory visualisation. It is primarily an interface to the Lattice graphics system (from the lattice package), but also produces displays from the vcd package for categorical data.
Given a multivariate dataset (either a data frame
or a
table
), Latticist attempts to produce useful displays based on
the properties of the data. The user chooses variables or expressions
for the plot axes, for grouping, conditioning and subsetting. Some
hypervariate displays are also available.
A minimal graphical user interface is available, built on the gWidgets package. This requires one of the "toolkit implementations" to installed: gWidgetstcltk, gWidgetsRGtk2 or gWidgetsrJava. Note that gWidgetsrJava is currently broken (as of version 0.0-13).
The fastest way to start, without any external system requirements, is
to install.packages("gWidgetstcltk")
. However, that does not
support an embedded graphics device, so the plots will appear in a
separate window.
Alternatively, Latticist can be run as a toolbar extension to
playwith
.
This brings many extra features, such as dynamic zooming, identifying
data points, linked brushing, etc. Note that the playwith
package requires RGtk2 and, therefore, the GTK+ libraries.
To enable all types of graphic displays, install the deldir package, as well as hexbin, a BioConductor package, which can be installed as follows:
source("http://bioconductor.org/biocLite.R")
biocLite("hexbin")
The playwith method invisibly returns the playState
object representing the plot window. One can close it with
playDevOff()
or dev.off()
.
The gWidgets method invisibly returns the gwindow
object. One can close it with dispose()
.
Felix Andrews felix@nfrac.org
For an excellent introduction to and coverage of Lattice:
Sarkar, Deepayan (2008) “Lattice: Multivariate Data Visualization with R”, Springer. ISBN: 978-0-387-75968-5 http://lmdvr.r-forge.r-project.org/
The mosaic displays and extensions from vcd are well described in:
David Meyer, Achim Zeileis, and Kurt Hornik (2006). “The Strucplot Framework: Visualizing Multi-Way Contingency Tables with vcd”. Journal of Statistical Software, 17(3), 1-48. http://www.jstatsoft.org/v17/i03/
latticistCompose
,
latticist.options
,
Lattice,
lattice.demo
in the TeachingDemos package.
if (interactive()) { options(device.ask.default = FALSE) ## data.frame example latticist(iris) ## three different GUIs: spec <- list(yvar = "uptake", xvar = "conc", groups = "Treatment", cond = "Type") if (require("gWidgetstcltk") && isTRUE(gconfirm("Show tcl/tk-based GUI?"))) { options(guiToolkit = "tcltk") latticist(CO2, spec = spec, use.playwith = FALSE) } if (require("gWidgetsRGtk2") && isTRUE(gconfirm("Show RGtk2-based GUI?"))) { options(guiToolkit = "RGtk2") latticist(CO2, spec = spec, use.playwith = FALSE) } if (require("playwith") && isTRUE(gconfirm("Show playwith-based GUI?"))) { latticist(CO2, spec = spec, use.playwith = TRUE) } ## table example ## Titanic dataset: Survival of passengers on the Titanic ## summarised by economic status (class), sex, age and survival. latticist(Titanic, spec = list(groups = "Survived")) }