I have hundreds of formulas stored in a vector, and need apply those formulas to tree variables (called dbh and ht) in a dataframe. The situation can be reproduced as follows:
vec_formulas = c('0.32*dbh^1.22*ht^0.99',
'0.44 + 3.55*log(dbh) + log(ht)^1.03',
'0.40*dbh^1.30 + ht*1.12') # wrote only 3, but there are many
set.seed(123)
df_trees = data.frame(tree = 1:200,
dbh = rnorm(200, mean=30),
ht = rnorm(200, mean=15))
I need some result that apply every formula to every tree. If necessary, I can transform 'vec_formulas' into dataframe or datatable.
Thanks in advance!
-H.