cogDisplayHref: DisplayHref Cognostic

Description Usage Arguments Value See Also Examples

View source: R/cognostics.R

Description

Create href that points to another trelliscope display with optional state

Usage

1
2
3
cogDisplayHref(state, label = "link", desc = "display link",
  group = "common", target = "_blank", defLabel = FALSE,
  defActive = FALSE, filterable = FALSE, sortable = TRUE, log = FALSE)

Arguments

state

the state of the display to link to, using stateSpec - at a minimum the name and group of the display must be specivied - additionally, default parameter settings (such as layout, sorting, filtering, etc.) can be set to be in effect when the display is launched (see stateSpec 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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
## Not run: 
library(ggplot2)

vdbConn(tempfile(), autoYes = TRUE)

# divide housing data by county
byCounty <- divide(housingData::housing, by = c("county", "state"))

xlim <- as.Date(c("2008-01-31", "2016-01-31"))

# plot list price vs. time for each county
makeDisplay(byCounty, name = "county_time",
  panelFn = function(x)
    ggplot(x, aes(time, medListPriceSqft)) +
      geom_point() + xlim(xlim))

# divide housing data by state
byState <- divide(housingData::housing, by = "state")

# create a "displayHref" cognostic that links to the by county display
# filtered down to all counties in the current state
cogFn <- function(x) {
  state <- stateSpec(
    name = "county_time",
    sort = list(county = "asc"),
    layout = list(nrow = 2, ncol = 4),
    filter = list(state = list(select = getSplitVar(x, "state"))))

  list(countyPlots = cogDisplayHref(state = state, defLabel = TRUE))
}

# plot distribution of list price vs. time for each state
makeDisplay(byState, name = "state_time_CI",
  panelFn = function(x)
    ggplot(x, aes(time, medListPriceSqft)) +
      stat_summary(fun.data = "mean_cl_boot") + xlim(xlim),
  cogFn = cogFn)

# open up the state display
# try clicking on the link for "countyPlots"
# the by county display will be loaded filtered to the state
view("state_time_CI")

## End(Not run)

delta-rho/trelliscope documentation built on May 12, 2017, 10:49 p.m.