| tags: [ R R packages Rmarkdown ] categories: [Administration Coding To-do ]

Interactive timelines with timevis

An example timeline created with the R package timevis.

The code to generate the above timeline:

# load the package
library(timevis)
# define the data to be displayed
data <- data.frame(
  id      = 1:11,
  content = c("Start", "", 
              "Research Proposal", "Obj 1. Phenotype Data QC & Analysis",
              "Obj 2. Gneotype Data QC & Annotation", "Obj 3. Heritability Analysis", 
              "Obj 4. Pedigree-based GWAS", "Obj 5. Machine-learning GWAS", "Finish", "", "Hand-in"),
  start   = c("2018-01-15", "2018-02-15", 
              "2018-02-15", "2018-03-29",
              "2018-05-01", "2018-05-28", 
              "2018-06-12", "2018-07-28", 
              "2018-11-01", "2018-03-29", "2018-10-07"),
  end     = c(NA, "2018-10-07", 
              "2018-03-28", "2018-05-07", 
              "2018-05-28", "2018-06-12", 
              "2018-07-28", "2018-09-20", 
              NA, "2018-09-20", NA),
  group   = c(3, rep(1, 2), rep(2, 5),3, 2, 3),
  type    = c("box", "background", "range", "range", "range", "range", "range", "range", "box", "background", "box"),
  style = c("color: black;", "color: cadetblue;", "color: cadetblue;", "color: darkred;",
            "color: darkred;", "color: darkred;", "color: darkred;", "color: darkred;", "color: black;", "color: darkred;", "color: black;"),
  fit = TRUE)
# add configuration options allowing editing of content in timeline
config <- list(
      editable = TRUE,
      multiselect = TRUE
)
# add grouping information
groups <- data.frame(id = c(1,2,3), content = c("Writing", "Analysis", "Admin"))
# generate the timeline
timevis(data, groups = groups, width = 1260, height = 250, options = config)