Create and Navigate Large Multi-Panel Visual Displays

Authors: Ryan Hafen [aut, cre],Jeremiah Rounds [ctb],Barret Schloerke [ctb],Landon Sego [ctb]

Version: 0.9.4

License: BSD_3_clause + file LICENSE

Description

An extension of Trellis Display that enables creation, organization, and interactive viewing of multi-panel displays created against potentially very large data sets. The dynamic viewer tiles panels of a display across the screen in a web browser and allows the user to interactively page through the panels and sort and filter them based on “cognostic” metrics computed for each panel. Panels can be created using many of R’s plotting capabilities, including base R graphics, ‘lattice’, ‘ggplot2’, and many ‘htmlwidgets’. Conditioning is handled through the ‘datadr’ package, which enables ‘Trelliscope’ displays with potentially millions of panels to be created against terabytes of data on systems like ‘Hadoop’. While designed to scale, ‘Trelliscope’ displays can also be very useful for small data sets.

Depends

R (>= 3.0.0), datadr (>= 0.8.5),

Imports

lattice (>= 0.20-23), ggplot2, data.table, base64enc, shiny (>= 0.12.0), htmlwidgets (>= 0.5.0), digest, jsonlite, hexbin, png, rsconnect

Suggests

Cairo, dplyr, testthat (>= 0.11.0), roxygen2 (>= 5.0.1), scagnostics, housingData

Enhances

(none)

Making Displays

makeDisplay

Create a Trelliscope Display

Create a trelliscope display and add it to a visualization database (VDB)

Usage

makeDisplay(data, name, group = "common", desc = "", mdDesc = NULL,
  height = 500, width = 500, panelFn = NULL, lims = list(x = "free", y =
  "free", prepanelFn = NULL), cogFn = NULL, state = NULL,
  preRender = FALSE, cogConn = dfCogConn(), output = NULL,
  conn = getOption("vdbConn"), verbose = TRUE, keySig = NULL,
  params = NULL, packages = NULL, control = NULL, detectGlobals = TRUE)

Arguments

data
data of class “ddo” or “ddf” (see ddo, ddf)
name
the name of the display (no special characters, spaces are converted to underscores)
group
the group the display belongs to, where displays are organized into groups (no special characters, spaces are converted to underscores). Defaults to “common”
desc
a description of the display (used in the viewer)
mdDesc
an optional longer-form description of the display and data, which can be text or can be a path to a markdown file or file with html snippets. The description will appear in the “Display Information” panel in the Trelliscope viewer.
height
reference dimensions (in pixels) for each panel (panels will be resized based on available space in the viewer)
width
reference dimensions (in pixels) for each panel (panels will be resized based on available space in the viewer)
panelFn
a function that produces a plot and takes one argument, which will be the current split of the data being passed to it. It is recommended that you first test panelFn on a single key-value pair using panelFn(data[[1]][[2]]). This function must return either an object of class “ggplot”, “trellis”, or return “NULL” (for base plot commands)
lims
either an object of class “trsLims” as obtained from setLims or a list with elements x, y, and prepanelFn, that specify how to apply prepanel and setLims
cogFn
a function that returns a named list, where each element of the list is a cognostic feature (with length 1). This list must be coerceable to a 1-row data frame. The function should take one argument, which will be the current split of the data being passed to it. Useful to test with cogFn(divExample(dat))
state
if specified, this tells the viewer the default parameter settings (such as layout, sorting, filtering, etc.) to use when the display is viewed (see validateState for details)
preRender
should the panels be pre-rendered and stored (TRUE), or rendered on-the-fly (FALSE, default)? Default is recommended unless rendering is very expensive. See Details.
cogConn
a connection to store the cognostics data. By default, this is dfCogConn().
output
how to store the panels and metadata for the display (unnecessary to specify in most cases – see details)
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
verbose
print status messages?
keySig
a user-defined key signature (string - see details)
params
a named list of objects external to the input data that are needed in the distributed computing (most should be taken care of automatically such that this is rarely necessary to specify)
packages
a vector of R package names that contain functions used in panelFn or cogFn (most should be taken care of automatically such that this is rarely necessary to specify)
control
parameters specifying how the backend should handle things (most-likely parameters to rhwatch in RHIPE) - see rhipeControl and localDiskControl
detectGlobals
if TRUE params are automatically detected (packages are always auto-detected)

Details

Many of the parameters are optional or have defaults. For several examples, see the documentation at deltarho.org: http://deltarho.org/docs-trelliscope

Panels by default are not pre-rendered. Instead, this function creates a display object and computes and stores the cognostics. Panels are then rendered on the fly by the DeltaRho backend and pushed to the Trelliscope viewer as html with the panel images embedded in the html. If a user would like to pre-render the images for every subset (using preRender = TRUE), then by default the image files for the panels will be stored to a local disk connection (see localDiskConn) inside the VDB directory, organized in subdirectories by group and name of the display. Optionally, the user can specify the output parameter to be any valid “kvConnection” object, as long as it is one that persists on disk (e.g. hdfsConn).

keySig does not generally need to be specified. It is useful to specify when creating multiple displays that you would like to be treated as related displays, so that you can view them side by side. Two displays are determined to be related when their key signatures, typically computed as a md5 hash of the complete collection of keys, match. Sometimes two displays will have data where the keys match for a significant portion of subsets, but not all. Manually specifying the same keySig for each can ensure that they will be treated as related displays.

Examples

# see docs

See also

prepanel, setLims, divide

Author

Ryan Hafen

qtrellis

Quick trelliscope display for data frame-like inputs

Usage

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 dont 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 dont 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

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

splod

Create a Scatterplot Display

Create a scatterplot display (splod)

Usage

splod(data, id.vars = NULL, name = NULL, desc = NULL,
  cogFn = splodCogFn, panelFn = splodPanelFn, verbose = TRUE, ...)

Arguments

data
a data.frame or an object of class “splodDat”
id.vars
variables to ignore when computing all pairs of variables
name, desc, cogFn, panelFn, verbose, …
parameters passed to makeDisplay

Value

an object of class localDiv that can be passed to splod

References

Wilkinsons scagnostics paper.

See also

makeDisplay, makeSplodData, splodPanelFn

Author

Ryan Hafen

Handling Displays

vdbConn

Connect to a VDB

Connect to a new or existing visualization database

Usage

vdbConn(path, name = NULL, autoYes = FALSE, updateFiles = TRUE,
  verbose = TRUE)

Arguments

path
The path on the local file system where the directory for the VDB is located
name
A character string giving the name of the VDB. If the VDB already exists and name = NULL, the previous name is used. If the VDB exists and a string is provided for name, the name is overwritten. The primary purpose of the name argument is to facilitate deploying the trelliscope display as a Shiny app. See the appName argument of deployToShinyApps
autoYes
should questions to proceed with directory creation operations be automatically answered with “yes”?
updateFiles
upon connection, should the Trelliscope viewer app files be updated in the VDB directory?
verbose
should messages be printed about what is being done?

Details

Connecting to a VDB is required prior to calling makeDisplay or view.

Value

An object of class vdbConn that contains the path and name of the VDB. This object is also assigned to the vdbConn option, and can be retrieved via getOption(“vdbConn”)

Author

Ryan Hafen

view

View a Display or Run Shiny Display Viewer

View a display or run Shiny display viewer

Usage

view(name = NULL, group = NULL, state = NULL, openBrowser = TRUE,
  conn = getOption("vdbConn"), port = getOption("trelliscopePort"))

Arguments

name, group
optional parameters to load the viewer with a pre-specified display - if not specified, the viewer will launch with a list to choose from
state
an optional list of state variables to set the default viewing state for layout, sorting, filtering, and labels (see details)
openBrowser
should the browser be automatically launched?
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
port
what port to use for the viewer - if not specified, will look for “trelliscopePort” set in Rs global options, followed by a search for a system-level environment variable “TRELLISCOPE_PORT”. If none of these are defined, a random port assigned provided by shiny will be used.

Author

Ryan Hafen

listDisplays

List Displays in a VDB

List displays in a VDB.

Usage

listDisplays(conn = getOption("vdbConn"))

Arguments

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

See also

makeDisplay, removeDisplay, view

Author

Ryan Hafen

getDisplay

Retrieve Display Object from VDB

Retrieve a display object from a VDB.

Usage

getDisplay(name, group = NULL, conn = getOption("vdbConn"))

Arguments

name
the name of the display
group
the group of the display
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

Details

If a display is uniquely determined by its name, then group is not required.

Value

a display object

See also

makeDisplay, removeDisplay

Author

Ryan Hafen

updateDisplay

Update a Display Object

Usage

updateDisplay(name, ..., group = NULL, conn = getOption("vdbConn"))

Arguments

name
the name of the display
group
the group the display belongs to
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
display parameters to update which must be one of “desc”, “width”, “height”, “keySig”, “panelFn”, “state” - see makeDisplay for details on these parameters.

removeDisplay

Remove a Display from a VDB

Remove a display from a VDB.

Usage

removeDisplay(name = NULL, group = NULL, conn = getOption("vdbConn"),
  autoYes = FALSE, verbose = TRUE)

Arguments

name
the name of the display
group
the group of the display
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
autoYes
should questions to proceed with display removal be automatically answered with “yes”?
verbose
logical - print messages about what is being done

Details

If a display is uniquely determined by its name, then group is not required.

See also

makeDisplay

Author

Ryan Hafen

Cognostics

cog

Create a Cognostics Object

Create a cognostics object. To be used inside of the function passed to the cogFn argument of makeDisplay for each cognostics value to be computed for each subset.

Usage

cog(val = NULL, desc = "", group = "common", type = NULL,
  defLabel = FALSE, defActive = TRUE, filterable = TRUE,
  sortable = TRUE, log = NULL)

Arguments

val
a scalar value (numeric, characer, date, etc.)
desc
a description for this cognostic value
group
optional categorization of the cognostic for organizational purposes
type
the desired type of cognostic you would like to compute (see details)
defLabel
should this cognostic be used as a panel label in the viewer by default?
defActive
should this cognostic be active (available for sort / filter / sample) by default?
filterable
should this cognostic be filterable? Default is TRUE. It can be useful to set this to FALSE if the cognostic is categorical with many unique values and is only desired to be used as a panel label.
sortable
should this cognostic be sortable?
log
when being used in the viewer for visual univariate and bivariate filters, should the log be computed? Useful when the distribution of the cognostic is very long-tailed or has large outliers. Can either be a logical or a positive integer indicating the base.

Details

Different types of cognostics can be specified through the type argument that will affect how the user is able to interact with those cognostics in the viewer. This can usually be ignored because it will be inferred from the implicit data type of val. But there are special types of cognostics, such as geographic coordinates and relations (not implemented) that can be specified as well. Current possibilities for type are “key”, “integer”, “numeric”, “factor”, “date”, “time”, “geo”, “rel”, “hier”, “href”.

Value

object of class “cog”

See also

makeDisplay, cogRange, cogMean, cogScagnostics, cogLoessRMSE

Author

Ryan Hafen

cogMean

Compute Mean Cognostic

Compute mean to be used as cognostics in a trelliscope display.

Usage

cogMean(x, desc = "mean", group = "common", defLabel = FALSE,
  defActive = TRUE, filterable = TRUE, sortable = TRUE, log = FALSE)

Arguments

x
numeric vector from which to compute the mean
desc, group, defLabel, defActive, filterable, sortable, log
arguments passed to cog

Examples

cogMean(rnorm(100))

See also

cog

Author

Ryan Hafen

cogRange

Compute Range Cognostic

Compute range to be used as cognostics in a trelliscope display.

Usage

cogRange(x, desc = "range (max - min)", group = "common",
  defLabel = FALSE, defActive = TRUE, filterable = TRUE,
  sortable = TRUE, log = FALSE)

Arguments

x
numeric vector from which to compute the range
desc, group, defLabel, defActive, filterable, sortable, log
arguments passed to cog

Examples

cogRange(rnorm(100))

See also

cog

Author

Ryan Hafen

cogLoessRMSE

Compute RMSE of Loess Fit Cognostic

Compute RMSE of loess fit as a cognostic to be used as cognostics in a trelliscope display.

Usage

cogLoessRMSE(..., desc = "RMSE of residuals from loess fit",
  group = "common", defLabel = FALSE, defActive = TRUE,
  filterable = TRUE, sortable = TRUE, log = FALSE)

Arguments

desc, group, defLabel, defActive, filterable, sortable, log
arguments passed to cog
arguments to be passed to link{loess}, such as the formula, data, smoothing parameters, etc.

Examples

cogLoessRMSE(dist ~ speed, span = 0.5, data = cars)

See also

cog

Author

Ryan Hafen

cogHref

Href Cognostic

Create href to be used as cognostics in a trelliscope display.

Usage

cogHref(x, label = "link", desc = "link", group = "common",
  target = "_blank", defLabel = FALSE, defActive = FALSE,
  filterable = FALSE, sortable = TRUE, log = FALSE)

Arguments

x
URL to link to
label
label of the href
desc, group, defLabel, defActive, filterable, sortable, log
arguments passed to cog
target
value to be used for the target attribute of the a html tag - default is “_blank" which will open the link in a new window

Examples

cogHref("www.google.com")

See also

cog

Author

Ryan Hafen

cogDisplayHref

DisplayHref Cognostic

Create href that points to another trelliscope display with optional state

Usage

cogDisplayHref(displayName, displayGroup = "common", state = NULL,
  label = "link", desc = "display link", group = "common",
  target = "_blank", defLabel = FALSE, defActive = FALSE,
  filterable = FALSE, sortable = TRUE, log = FALSE)

Arguments

displayName
the name of the display
displayGroup
the group the display belongs to
state
if specified, this tells the viewer the default parameter settings (such as layout, sorting, filtering, etc.) to use when the display is viewed (see validateState for details)
label
label of the href
desc, group, defLabel, defActive, filterable, sortable, log
arguments passed to cog
target
value to be used for the target attribute of the a html tag - default is “_blank" which will open the link in a new window

Value

a hash string

See also

validateState, cogHref

Author

Ryan Hafen

cogScagnostics

Compute Scagnostics

Compute list of scagnostics (see scagnostics) to be used as cognostics in a trelliscope display.

Usage

cogScagnostics(x, y, group = "scagnostics", defLabel = FALSE,
  defActive = TRUE, filterable = TRUE, sortable = TRUE, log = FALSE)

Arguments

x
vector of the x-axis data for a scatterplot
y
vector of the y-axis data for a scatterplot
group, defLabel, defActive, filterable, sortable, log
arguments passed to cog

Examples

cogScagnostics(iris$Sepal.Length, iris$Sepal.Width)

See also

cog

Author

Ryan Hafen

Sharing Displays

deployToShinyApps

Deploy VDB to shinyapps.io

Usage

deployToShinyApps(vdbConn = getOption("vdbConn"), appName = NULL,
  account = NULL, redeploy = TRUE, size = NULL, instances = NULL,
  quiet = FALSE)

Arguments

vdbConn
A vdbConn object containing the VDB connection settings
appName
name of application (app will be available at https://[account].shinyapps.io/[appName]/) - if not supplied, will use the name of VDB connection
account
passed to shinyapps::configureApp
redeploy
passed to shinyapps::configureApp
size
passed to shinyapps::configureApp
instances
passed to shinyapps::configureApp
quiet
passed to shinyapps::configureApp

Details

If you do not have a shinyapps.io account and have not set your account info, first visit here prior to calling this function: http://shiny.rstudio.com/articles/shinyapps.html.

Author

Ryan Hafen

syncLocalData

syncLocalData

Sync localDisk Objects to VDB

Sync localDisk data that is used for VDB displays located throughout the system to a ‘data’ directory inside the VDB - useful for collecting data before syncing with a web server, and used inside of webSync.

Usage

syncLocalData(vdbConn = getOption("vdbConn"), rsync = NULL)

Arguments

vdbConn
VDB connection settings
rsync
location of rsync binary

See also

webSync, webConn

Author

Ryan Hafen

webConn

Initialize a Web Connection

Initialize a connection to a web server

Usage

webConn(user = NULL, ip = NULL, appDir = "/srv/shiny-server",
  name = NULL)

Arguments

user
the username to log on to the web server
ip
the IP address of the web server - if NULL, it is assumed that your web server is on the same machine that you are working on
appDir
the directory where Shiny apps go on the web server - defaults to the default location of /srv/shiny-server
name
the name of the directory in appDir under which to store the application - if not supplied, it defaults to the name provided in the vdb connection

See also

webSync

Author

Ryan Hafen

webSync

Sync VDB Files to a Web Server

Sync VDB files to a web server

Usage

webSync(vdbConn = getOption("vdbConn"), webConn = getOption("vdbWebConn"),
  fixPermissions = FALSE, verbose = FALSE, rsync = NULL)

Arguments

vdbConn
VDB connection settings
webConn
web connection settings
fixPermissions
should an attempt be made to fix permissions in the web directory?
verbose
show rsync output
rsync
location of rsync binary

Details

This requires rsync to be installed on your machine. If you are syncing via ssh, this only works if public key authentication is enabled between your local machine and the remote server.

See also

webConn, syncLocalData

Author

Ryan Hafen

Misc

splodCogFn

Default Cognostics Function for splod

Default cognostics function for splod

Usage

splodCogFn(df)

Arguments

df
a subset of data created by makeSplodData

Value

a data.frame of scagnostics for the given subset

References

Wilkinsons scagnostics paper.

See also

splodPanelFn, splod, makeSplodData

Author

Ryan Hafen

splodPanelFn

Default Plot Function for splod

Default plot function for splod

Usage

splodPanelFn(df)

Arguments

df
a subset of data created by makeSplodData

Value

a trellis plot object of a scatterplot for the given subset

References

Wilkinsons scagnostics paper.

See also

splodCogFn, splod, makeSplodData

Author

Ryan Hafen

batting

Batting Data

Batting data

Usage

data(batting)

Format

A data frame with 1406 rows and 22 variables

Details

  • playerID. : Factor w/ 17908 levels “aardsda01”,“aaronha01”,..: 1 6 34 34 37 40 40 41 46 51 …
  • yearID. : int 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 …
  • stint. : int 1 1 1 2 1 1 2 1 1 1 …
  • teamID. : Factor w/ 149 levels “ALT”,“ANA”,“ARI”,..: 93 58 71 72 66 45 96 16 116 94 …
  • lgID. : Factor w/ 6 levels “AA”,“AL”,“FL”,..: 2 4 2 4 2 2 2 2 2 4 …
    1.    : int  1 37 8 92 22 26 1 69 153 45 ...
    2. AB. : int NA 7 24 195 70 0 NA 0 607 0 …
      1.    : int  NA 0 1 28 5 0 NA 0 84 0 ...
        1.    : int  NA 1 5 48 18 0 NA 0 137 0 ...
        2. X2B. : int NA 0 3 8 2 0 NA 0 22 0 …
        3. X3B. : int NA 0 0 1 1 0 NA 0 2 0 …
        4. HR. : int NA 0 0 3 1 0 NA 0 12 0 …
        5. RBI. : int NA 0 5 19 15 0 NA 0 50 0 …
        6. SB. : int NA 0 0 6 0 0 NA 0 13 0 …
        7. CS. : int NA 0 0 2 0 0 NA 0 3 0 …
        8. BB. : int NA 0 2 35 2 0 NA 0 59 0 …
        9. SO. : int NA 3 5 51 13 0 NA 0 124 0 …
        10. IBB. : int NA 0 0 3 0 0 NA 0 7 0 …
        11. HBP. : int NA 0 0 0 1 0 NA 0 0 0 …
        12. SH. : int NA 0 0 0 0 0 NA 0 1 0 …
        13. SF. : int NA 0 1 0 1 0 NA 0 1 0 …
        14. GIDP. : int NA 1 1 6 1 0 NA 0 3 0 …
        15. price. price in US dollars ($326–$18,823)

noMargins

Remove Margins from Trellis/Lattice Plot

Removes whitespace surrounding a trellis plot. Ideal for makeDisplay because when tiling multiple panels, a lot of space is wasted with the margins.

Usage

noMargins(..., topkey = FALSE, rightkey = FALSE)

Arguments

topkey
should extra space be added for a top key?
rightkey
should extra space be added for a right key?
a list of other parameters to be passed to par.settings

Examples

xyplot(c(1:10) ~ c(1:10) | sample(letters[1:2], 10, replace=TRUE),
  par.settings=noMargins()
)

# with additional par.settings...
xyplot(c(1:10) ~ c(1:10) | sample(letters[1:2], 10, replace=TRUE),
  par.settings=noMargins(
    list(plot.symbol=list(col="black"))
  )
)

See also

xyplot, makeDisplay

Author

Ryan Hafen

validateState

Validate State Parameters

Validate state parameters for a Trelliscope display

Usage

validateState(x, name = NULL, group = NULL, displayObj = NULL)

Arguments

x
a list of state parameter settings (such as layout, sorting, filtering, etc.) to use when the display is viewed (see details)
name
the name of the display (optional but recommended - if checking state against variable names, etc. of the display is desired)
group
the group the display belongs to
displayObj
the display object (can be specified in place of name and group)

Details

Trelliscope allows you to specify either a default state in makeDisplay or specify the state of the display when you call view. Aspects of the display that can be controlled with the state include:

  • labels a vector of names of cognostics to be shown as labels underneath each panel. If not specified, the default is to show labels for any of the splitting variables that created the partition of the data being plotted.
  • layout a list with optional elements nrow, ncol, and arrange. nrow and ncol specify the arrangement of the panels into rows and columns (nrow = 1 and ncol = 1 are defaults), and arrange can be either “row” or “col” and specified whether to sort the panels by row or by column (“row” is default)
  • sort a named list where each name corresponds to a cognostic name and the value is either “asc” or “desc” for sorting in ascending or descending order. The order in which sorting is applied to each variable is according to the order of the variables specified.
  • filter a named list where each name corresponds to a cognostic name and the value is a specification of either “regex” or “select” for categorical variables, or a range, “from” and “to”, for quantitative variables. For a “regex”, a simple regular expression string is specified, and the filter finds all matches for the regular expression against the variable. For “select” a vector of strings is specified, and all exact matches are returned. For the range filter, all values of the specified variable within the range “from” and “to” are returned. If either “from” or “to” are omitted, they are treated as -Inf and Inf respectively.

Value

a modified state parameter list that is valid, an object of class “cogState”

Examples

state <- list(
  sort = list(state = "desc", county = "asc"),
  filter = list(
    county = list(regex = "Ben"),
    state = list(select = c("OR", "WA")),
    meanList = list(from = 50, to = 150)
  ),
  layout = list(nrow = 2, ncol = 4),
  labels = c("county", "state")
)
validateState(state)

See also

view, cogDisplayHref

Author

Ryan Hafen

makeStateHash

Make a URL hash out of state information

Make a URL hash out of cognostics state information

Usage

makeStateHash(x, name = NULL, group = NULL)

Arguments

x
a list of cognostics state parameters
name
the name of the display
group
the group the display belongs to

Value

a URL hash

Examples

x <- list(
  sort = list(state = "desc", county = "asc"),
  filter = list(
    county = list(regex = "Bent"),
    state = list(select = "WA"),
    meanList = list(from = 0, to = 1)
  ),
  layout = list(nrow = 2, ncol = 4),
  labels = c("county", "state")
)
makeStateHash(validateState(x))

See also

validateState

Author

Ryan Hafen

makeSplodData

Create Data Plottable by splod

Create pairwise scatterplot data plottable by splod

Usage

makeSplodData(data, id.vars = NULL, ...)

Arguments

data
a data.frame
id.vars
variables to ignore when computing all pairs of variables
TODO

Value

an object of class localDiv and splodDat that can be passed to splod

References

Wilkinsons scagnostics paper.

See also

splod, splodPanelFn

Author

Ryan Hafen

prepanel

Prepanel Function for Trelliscope Displays

Apply a prepanel function to objects of class “ddo” or “ddf” to determine ranges of x and y axis limits prior to creating a trelliscope display (makeDisplay). Useful in conjunction with setLims.

Usage

prepanel(data, prepanelFn = NULL, params = NULL, packages = NULL,
  control = NULL, verbose = TRUE)

Arguments

data
an object of class “localDiv” or “rhData”
prepanelFn
a prepanel function that returns a list specifying xlim and ylim for determining axis limits, and optionally dx and dy for determining aspect ratio (used to define slopes of line segments used for banking computations). prepanelFn can also be a panelFn (see makeDisplay) that returns either an object of class “trellis” or “ggplot”, since xlim and ylim can be determined from these.
params
a named list of parameters external to the input data that are needed in the distributed computing (most should be taken care of automatically such that this is rarely necessary to specify)
packages
a vector of R package names that contain functions used in prepanelFn (most should be taken care of automatically such that this is rarely necessary to specify)
control
parameters specifying how the backend should handle things (most-likely parameters to rhwatch in RHIPE) - see rhipeControl and localDiskControl
verbose
print status messages?

Details

The plot method plots the sorted axis ranges for the x and y axis for the case of “same” (all axis limits share the same range) and “sliced” (all axis limits share the) and can be useful in helping determine how to ultimately set the limits.

You do not need to use prepanel() to ultimately create a display with makeDisplay(), but if you bypass, you will either need to specify your own limits in your plot command, or do nothing, in which case each individual plot will have limits based on the data in the split being plotted (the axes will be “free”).

Axis limits are very important. What makes viewing groups of plots of subsets of data (“small multiples”) so powerful is being able to make meaningful visual comparisons across plots. This is much easier to do if scales for each plot are commensurate.

This function is also useful for identifying subsets with very large outlying values, and in conjunction with setLims, allows you to account for that prior to the expensive process of creating all of the plots.

Value

object of class “trsPre”. This is a list of the x and y axis ranges for each split, along with the aspect ratio banking value if dx and dy are supplied in prepanelFn. Can be used with plot.trsPre and setLims.

Examples

irisSplit <- datadr::divide(iris, "Species")
irisPreFn <- function(x) {
  list(
    xlim = range(x$Sepal.Length),
    ylim = range(x$Sepal.Width)
  )
}
irisPre <- prepanel(irisSplit, prepanelFn = irisPreFn)
plot(irisPre)#' 

See also

x plot.trsPre, setLims, makeDisplay

Author

Ryan Hafen

vdbCopyRSource

Copy files ending in .R from source directory into a VDB-wide global code directory for use in Trelliscope displays

These R files will be sourced in the global environment of the Trelliscope Viewer when the viewer is launched and the resulting objects will be available to all displays throughout the viewing session. Useful for getting custom functions into the global environment.

Usage

vdbCopyRSource(fromDir, conn = getOption("vdbConn"))

Arguments

fromDir
directory with R source
conn
vdb connection

Examples

vdbCopyRSource(".") # copies R files from current directory

Author

Jeremiah Rounds

vdbGlobalsExist

Check to see if the VDB-wide global data file exists

Usage

vdbGlobalsExist(conn = getOption("vdbConn"))

Arguments

conn
vdb connection

Value

logical

Examples

vdbGlobalsExist()

Author

Jeremiah Rounds

vdbGlobalsFile

Path to VDB global data storage file

Returns an appropriate file name to save VDB-wide globals to for use in Trelliscope displays

Usage

vdbGlobalsFile(conn = getOption("vdbConn"))

Arguments

conn
vdb connection

Details

Objects in this rdata file will be loaded by the Trelliscope Viewer when the viewer is launched and the data will be available to all displays throughout the viewing session.

Value

character file name

Examples

save(foo, file = globalsPath())

Author

Jeremiah Rounds