qtrellis: Quick trelliscope display for data frame-like inputs

Description Usage Arguments Note Examples

View source: R/qtrellis.R

Description

Quick trelliscope display for data frame-like inputs

Usage

1
2
qtrellis(x, panel = NULL, cog = NULL, by = NULL, layout = c(1, 1),
  conn = getOption("vdbConn"), ...)

Arguments

x

either a data frame

panel

a function taking one argument (which will be a subset of the input data frame) and returning a plot

cog

an optional cognostics funtion to be applied to each subset

by

if the input is a data frame, a character vector of column names to split the data by

layout

a vector indicating the number of rows and columns to arrange the panels in by default

conn

VDB connection info, typically stored in options("vdbConn") at the beginning of a session, and not necessary to specify here if a valid "vdbConn" object exists or if you would like to use a temporary one for this display

...

parameters passed to makeDisplay - most importantly name, group (see note below), width, and height

Note

If you don't have a vdb connection set up (see vdbConn), a temporary one will be created and used, and you can think of the plot as disposable. If you would like the plot to persist, set up a vdb connection. Likewise, if you don't supply name and group, the plot will be stored under defaults "qtrellis_plot" and "__qtrellis", and a subsequent call will cause the previous display with this name and group to be replaced. Therefore, if you want your display to persist, make sure a vdb connection has been set up prior to calling this function, and give it a unique name.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
panel <- function(x)
  xyplot(Sepal.Width ~ Sepal.Length, data = x)

p <- datadr::divide(iris, by = "Species") %>%
  qtrellis(panel, layout = c(1, 3))
p

# data frame input (need to specify 'by')
iris %>% qtrellis(panel, by = "Species")

# dplyr grouped tbl input
library(dplyr)
p <- iris %>%
  group_by(Species) %>%
  qtrellis(panel, layout = c(1, 3))
p

## End(Not run)

trelliscope documentation built on Sept. 20, 2017, 5:04 p.m.