[R] functions and strings
    Robin Hankin 
    r.hankin at noc.soton.ac.uk
       
    Wed Sep 13 09:54:22 CEST 2006
    
    
  
Hi Dmitris
thanks for this  but it's not quite right:
 > f <- function(x){sin(x)+exp(x)}
 > strng <- gsub("x", "xyz", deparse(body(f))[2])
 > sub('^[[:space:]]+', '', strng)
[1] "sin(xyz) + exyzp(xyz)"
and I would want "sin(xyz) + exp(xyz)"
On 13 Sep 2006, at 08:45, Dimitris Rizopoulos wrote:
> strng <- gsub("x", "xyz", deparse(body(f))[2])
> sub('^[[:space:]]+', '', strng)
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743
    
    
More information about the R-help
mailing list