Convert SEIR to XYZ coordinates fixed in a tetrahedron
SEIR_to_SIR_E(data, ternary_vars = c("S", "I", "R"), group_var = "E")
data | data frame with the following columns
|
---|---|
ternary_vars | named vector of the three variables to use as the sides
of the ternary plot. Can be of the form |
group_var | name of the variable to use as the color/feature/grouping vector. column name that is associated with the time step. Can either be a string or a promisary symbol |
data frame with the transformed variables SEIR -> s, i, r, group variables
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)#> t t l r f x y z #> 1 0 90 0 10 0 0.055 0.7794229 0.00000000 #> 2 1 80 10 10 0 0.005 0.6928203 0.00000000 #> 3 2 70 10 10 10 0.005 0.6350853 0.08164966 #> 4 3 60 10 10 20 0.005 0.5773503 0.16329932