reorder_by_vector: Reorder a Muller plot dataframe by a vector

View source: R/MullerPlot.R

reorder_by_vectorR Documentation

Reorder a Muller plot dataframe by a vector

Description

Reorder a Muller plot dataframe by a vector

Usage

reorder_by_vector(df, vector)

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

Value

The reordered dataframe.

Author(s)

Rob Noble, robjohnnoble@gmail.com

See Also

path_vector

Examples

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)


ggmuller documentation built on Feb. 16, 2023, 7:42 p.m.