Description Usage Arguments Value Author(s) References Examples
Given 3 vectors of equivalent length representing the year (or time identifier), cell ID, and group (cluster) assignment, make a transition table consisting of 4 columns indicating the year, cell, from-group (this year's group), and to-group (next year's group).
1 |
time |
A numeric vector of values indicating the years (or sampling points) at which each group assigment was made (e.g. 1, 2, 3,...). |
cell |
A numeric vector of values indicating the cell number for each group assignment. |
group |
A numeric vector of values indicating the group
membership of each cell in each year.
|
Returns a data frame with four columns representing the year cell, from-group (this year's group), and to-group (next year's group).
Bjorn J. Brooks, Lars Y. Pomara, Danny C. Lee
PAPER TITLE.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Test 1, Robust test of algorithm
# Make example in which only cells 2,3,4,5 experience transitions
# (cells 1,6,7 only contain one value)
t <- c(1,1,2,1,2,3,1,2,3,1,2,1,1) # Time values
c <- c(1,2,2,3,3,3,4,4,4,5,5,6,7) # Cell IDs
g <- c(1,1,2,1,2,3,3,2,1,1,2,1,1) # Cluster groups
mk_trn(time=t, cell=c, group=g) # Make transition table
# Test 2, Test data table input
tmp <- data.frame(cell=rep(1:2, each=3),
time=rep(1:3, times=2),
cluster=c(letters[1:3], LETTERS[1:3])) # Data table
tmp # Print to screen
mk_trn(time=tmp$time, cell=tmp$cell, group=tmp$cluster) # Make trans tbl
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.