sub.gadget.formulae | R Documentation |
Replace variables in formulae
sub.gadget.formulae( ex, replacements, year = stop("Specify year to use timevariable"), step = stop("Specify step to use timevariable") )
ex |
An unevaluated R expression or the result of parse.gadget.formulae, e.g. quote(2 + log(moo - 1)) |
replacements |
A list of variable names to either: a TimeVariable file, replacement gadget/R formulae, or value |
year |
If using TimeVariable files, specify the year to pull out of file |
step |
If using TimeVariable files, specify the step to pull out of file |
An R expression representing the gadget formulae, which could be run with eval(.., list(moo = 3))
sub.gadget.formulae(quote(log(moo) + oink + baa), list(moo = "#fish", oink = quote(2 + 2), baa = 5)) # ==> log(fish) + (2 + 2) + 5 ## Not run: tv <- read.gadget.file('.', 'timevariable', file_type = 'timevariable') sub.gadget.formulae(quote(log(moo) + oink), list(moo = tv), year = 1995, step = 1) # ==> log(grow1995) + oink ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.