Description Usage Arguments Value Examples
Works eigher on a list or on two arguments. In case of a list, comparison is done with respect to a reference entry. Besides the objects themselves also some of their attributes are compared, i.e. "equations", "parameters" and "events" and "forcings".
1 2 3 4 5 6 7 8 9 10 11 12 13 |
vec1 |
object of class eqnvec, |
... |
arguments going to the corresponding methods |
vec2 |
same as vec1. Not used if vec1 is a list. |
reference |
numeric of length one, the reference entry. |
data.frame
or list of data.frames with the differences.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Compare equation vectors
eq1 <- eqnvec(a = "-k1*a + k2*b", b = "k2*a - k2*b")
eq2 <- eqnvec(a = "-k1*a", b = "k2*a - k2*b", c = "k2*b")
compare(eq1, eq2)
## Compare character vectors
c1 <- c("a", "b")
c2 <- c("b", "c")
compare(c1, c2)
## Compare data.frames
d1 <- data.frame(var = "a", time = 1, value = 1:3, method = "replace")
d2 <- data.frame(var = "a", time = 1, value = 2:4, method = "replace")
compare(d1, d2)
## Compare structures like prediction functions
fn1 <- function(x) x^2
attr(fn1, "equations") <- eq1
attr(fn1, "parameters") <- c1
attr(fn1, "events") <- d1
fn2 <- function(x) x^3
attr(fn2, "equations") <- eq2
attr(fn2, "parameters") <- c2
attr(fn2, "events") <- d2
mylist <- list(f1 = fn1, f2 = fn2)
compare(mylist)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.