reorder_by_vector | R Documentation |
Reorder a Muller plot dataframe by a vector
reorder_by_vector(df, vector)
df |
Dataframe with column names "Identity", "Parent", and either "Generation" or "Time", in which each Identity appears exactly twice |
vector |
Vector of Identity values |
The reordered dataframe.
Rob Noble, robjohnnoble@gmail.com
path_vector
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.