[R] How to write string dynamicly?

Feng Qiu fqiu at gatech.edu
Wed Dec 27 04:37:35 CET 2006


Hi everyone:
         I'm trying to compose a string dynamicly for the parameter input of 
some function. For example:
In package MASS, function lda() require to input the name of predictor 
variable. Let's say the 16th column is the predictor variable. Then we call 
the function like this: lda(V16~., data=mydata). I don't want to hard-code 
the call, instead, I would like to use a dynamic expression for this 
parameter so that I can use my program on different set of data.
        I guess there are some function that can do this, but I didn't find 
it in "Introduction to R" so far, could someone please tell me this kind of 
function? Thank you!

Best,

Feng



More information about the R-help mailing list