bio_sankey: Longitudinal Sankey

View source: R/bio_sankey.R

bio_sankeyR Documentation

Longitudinal Sankey

Description

Creates a sankey plot with heatmaps showing how individuals progress over time.

Usage

bio_sankey(samp.order)

Arguments

samp.orders

A list of named vectors for sample order at each timepoint. Vector names must correspond to matchable ids.

Examples

library(survival)
data(kidney)
df <- kidney
library(lme4)
data(sleepstudy)
data = sleepstudy
data = data[data$Days !=1 | data$Subject != "308", ]
time.col="Days"
exp.cols = "Reaction"
sub.col = "Subject"

row.order=list()
for(i in unique(data[, time.col])){
 hm = Heatmap(data[data[, time.col] == i, exp.cols], cluster_rows=cluster)
 row.order[[paste('timepoint', as.character(i))]] = setNames(unlist(row_order(hm)), data[data[, time.col] == i, sub.col])
}

bio_sankey(samp.order=row.order)

KatrionaGoldmann/BioOutputs documentation built on May 21, 2022, 1:24 p.m.