trelliscope (version 0.9.7)

cogHref: Href Cognostic

Description

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

See Also

cog

Examples

Run this code
d <- divide(iris, by = "Species")

# cognostics function that links to wikipedia
cogFn <- function(x) {
  link <- paste0("https://en.wikipedia.org/wiki/Iris_", getSplitVar(x, "Species"))
  list(wiki = cogHref(link, desc = "Look up species on wikipedia", defLabel = TRUE))
}

# test the cognostics function on a subset
applyCogFn(cogFn, d[[1]])

# make a display with this cognostics function
vdbConn(tempfile(), autoYes = TRUE)
makeDisplay(d, name = "iris_sl_sw",
  cogFn = cogFn, panelFn = function(x)
    lattice::xyplot(Sepal.Length ~ Sepal.Width, data = x))

## Not run: 
# # clicking the link under each panel will open wikipedia
# view(name = "iris_sl_sw")
# ## End(Not run)

Run the code above in your browser using DataLab