Open jackolney opened 7 years ago
yeah, what we need to do is to detect all user parameters and shift them out into boxes in the shiny interface. I don't know if that's possible, but it would be super cool
(in the odin generator function you can get at the user variables by using the formals:
gen <- odin::odin({
deriv(N) <- r * N * (1 - N / K)
initial(N) <- N0
N0 <- user(1)
K <- user(100)
r <- user()
})
formals(gen)$user
# list(r = r, N0 = N0, K = K)
names(lapply(formals(gen)$user[-1], identity))
# [1] "r" "N0" "K"
I should probably write something to allow better interrogation of this though!
Thanks. Will have to test how odin reacts when user variables are manipulated from outside odin::odin({})
you'll want to fire them in (on a change) via $set_user
to the existing model. Recompile when the source code is changed only. I can elaborate further if that's useful (was just showing off your thing to someone and remembered how cool it was)
Noted.
Lets be honest, its a pretty wrapper around all your hard work 😄
odin
seems to recompile every time I adjust a parameter.Eugene says that this because I have put my
odin::user()
args in theodin::odin
file... need to quiz Rich on that