title: R evaluate a funtion with class string
body: <p>I have a function in string format <code>"dnorm(0,1)"</code> which I want to evaluate but I need to make a change to string first. How do I subsequently run the function from character format?</p>
  
  <pre><code>function_char_format = str_replace("dnorm(0,1),.,"r") %&gt;%
  str_replace(".","r") %&gt;% 
  str_replace("\\(","(1e4, ") #this returns "rnorm(100,0,1)"
  execute_function??(function_char_format) 
  </code></pre>
  
  <p>context:
  (I'm making a function where I'm extracting a distribution like "dnorm" from an r-object and need the corresponding "rnorm()" . The solution should also be applicable for "dbinom", "dpois" etc.)</p>
  
  <p>Edit: added str_replace line</p>