[R] How to write string dynamicly?

From: Feng Qiu <fqiu_at_gatech.edu>
Date: Wed 27 Dec 2006 - 03:37:35 GMT

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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu Dec 28 05:54:33 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 28 Dec 2006 - 03:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.