Convert SEIR to XYZ coordinates fixed in a tetrahedron

SEIR_to_XYZ(data, var_order = c("S", "E", "I", "R"), time_name = "t")

Arguments

data

data frame with the following columns

time

time step

S

Number of people in S

E

Number of people in E

I

Number of people in I

R

Number of people in R

var_order

vector of column names corresponding to the different axes of the tetrahedron-based coordinate system: (t, l, r, f) which stands for top, left, right, front. Can be of the form c("t", "l", "r", "f") or c(t,l,r,f).

time_name

column name that is associated with the time step. Can either be a string or a promisary symbol

Value

original data frame along with columns x, y, and z

Examples

seir <- data.frame(t = 0:3, S = c(90, 80, 70, 60), E = c(0, 10, 10, 10), I = c(10, 10, 10, 10), R = c(0, 0, 10, 20)) seir_xyz <- SEIR_to_XYZ(seir) #head(seir_xyz)