Displaying 1 result from an estimated 1 matches for "ex1ss".
Did you mean:
ex10s
2006 Aug 15
0
Help with workaround for: Function '`[`' is not in thederivatives table
...to
get even craftier.
> Ex1 <- D(Ex, "A__2")
> Ex1
A__1 * (exp(A__2 * X) * X)
> Ex1s <- deparse(Ex1)
> Ex1s
[1] "A__1 * (exp(A__2 * X) * X)"
> pat1 <- paste(Ident, "__", Subsc, sep = "")
> rep1 <- "\\1\\[\\2\\]"
> Ex1ss <- gsub(pat1, rep1, Ex1s)
> Ex1ss
[1] "A[1] * (exp(A[2] * X) * X)"
> Ex2 <- parse(text = Ex1ss)[[1]]
> Ex2
A[1] * (exp(A[2] * X) * X)
Which is the required result. This is messy and gets messier if you
are looking for some kind of generality, but you need to remember, R
i...