Converting an equation into R code -


i have long expression want convert r code. here example showing expression looks like/how written:

(a exp(-a t) t^4)/(24 (a-b) (a-c) (a-d)) 

in order understandable r, multiplication sign * should added between variables, brackets etc. there way automatically rather inserting manually? expression should this:

(a *exp(-a*t) *t^4)/(24* (a-b)* (a-c)* (a-d)) 

if input of form shown sufficient replace each space * using gsub this:

expr <- "(a exp(-a t) t^4)/(24 (a-b) (a-c) (a-d))" gsub(" +", "*", expr) ## [1] "(a*exp(-a*t)*t^4)/(24*(a-b)*(a-c)*(a-d))" 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -