I am writing a custom function that uses an R-function from the  
reshape package: cast.  However, my question could be applicable to  
any R function.

Normally one writes the arguments directly into a function, e.g.:

result=cast(table1, column1 + column2 + column3   ~    column4,  
mean)      (1)

I need to be able to write this statement as follows:

result=cast(table1, string_with_columns   ~    column4, mean)    (2)
string_with_columns = group of functions that ultimately outputs:  
"column1 + column2 + column3"

Statement 1 outputs the correct results because I have manually typed  
in the column names I want to use.  However, statement 2 thinks that  
'string' is the name of a column rather than knowing to paste the  
string in string.




OR




To phrase this problem in a more generic manner, here is an example  
using a simpler function:

first=4
second=6
third="first,second"
max(first,second)  //correctly outputs 6
max(third)  //outputs "first,second" because it doesn't know to paste  
in the variables first and second, how do I get R to do this?

Any help is appreciated.


Lori Simpson
703.760.8575


	[[alternative HTML version deleted]]


