Learn R Programming

ggmuller (version 0.5.6)

reorder_by_vector: Reorder a Muller plot dataframe by a vector

Description

Reorder a Muller plot dataframe by a vector

Usage

reorder_by_vector(df, vector)

Value

The reordered dataframe.

Arguments

df

Dataframe with column names "Identity", "Parent", and either "Generation" or "Time", in which each Identity appears exactly twice

vector

Vector of Identity values

Author

Rob Noble, robjohnnoble@gmail.com

See Also

path_vector

Examples

Run this code
df <- data.frame(Generation = c(rep(0, 6), rep(1, 6)), 
 Identity = rep(1:6,2), Population = c(1, rep(0, 5), 10, rep(1, 5)))
df <- rbind(df, df) # duplicate rows
require(dplyr)
df <- arrange(df, Generation) # put in chronological order
edges1 <- data.frame(Parent = c(1,1,1,3,3), Identity = 2:6) # adjacency matrix
path <- path_vector(edges1) # path through the adjacency matrix
reorder_by_vector(df, path)

Run the code above in your browser using DataLab