vistime_data {vistime}R Documentation

Standardize data to plot on a timeline plot

Description

Standardize data to plot on a timeline plot

Usage

vistime_data(
  data,
  col.event = "event",
  col.start = "start",
  col.end = "end",
  col.group = "group",
  col.color = "color",
  col.fontcolor = "fontcolor",
  col.tooltip = "tooltip",
  optimize_y = TRUE,
  ...
)

Arguments

data

data.frame that contains the data to be normalized

col.event

(optional, character) the column name in data that contains event names. Default: event.

col.start

(optional, character) the column name in data that contains start dates. Default: start.

col.end

(optional, character) the column name in data that contains end dates. Default: end.

col.group

(optional, character) the column name in data to be used for grouping. Default: group.

col.color

(optional, character) the column name in data that contains colors for events. Default: color, if not present, colors are chosen via RColorBrewer.

col.fontcolor

(optional, character) the column name in data that contains the font color for event labels. Default: fontcolor, if not present, color will be black.

col.tooltip

(optional, character) the column name in data that contains the mouseover tooltips for the events. Default: tooltip, if not present, then tooltips are built from event name and date.

optimize_y

(optional, logical) distribute events on y-axis by smart heuristic (default), otherwise use order of input data.

...

for deprecated arguments up to vistime 1.1.0 (like events, colors, ...)

Value

vistime_data returns a data.frame with the following columns: event, start, end, group, tooltip, label, col, fontcol, subplot, y

Examples

# presidents and vice presidents
pres <- data.frame(
  Position = rep(c("President", "Vice"), each = 3),
  Name = c("Washington", rep(c("Adams", "Jefferson"), 2), "Burr"),
  start = c("1789-03-29", "1797-02-03", "1801-02-03"),
  end = c("1797-02-03", "1801-02-03", "1809-02-03"),
  color = c("#cbb69d", "#603913", "#c69c6e"),
  fontcolor = c("black", "white", "black")
)

vistime_data(pres, col.event = "Position", col.group = "Name")

[Package vistime version 1.2.4 Index]