[R] How to dynamically replace the text behind dollar sign: '$'

谢一鸣 13636622737 at 163.com
Wed Feb 6 05:07:53 CET 2013


Dear ALL,

I need a function that takes character string as argument value and replaces corresponding argument( which is behind dollar sign "$") in function body with its value.  
  
For example:    

function(dataframe, argument="ANYTHING I WANT")
{   
       return(dataframe$argument)   
 }    

Even though I know there must be lots of possible alternative ways to do this, I really want to do the job just like the form in the above example and which I believe that has a close connection with "Programming on language" style(I read the term on some guides but really got no clue whether I refer to it here in a right way). 
Anyone who happens to know the method or the mechanism please kindly let me know. Thank you very much, and please reply in very simple English, because i am a poor English user.    

Thanks again,    
Xie YM



More information about the R-help mailing list