From: Chad Reyhan Bhatti <bhatticr_at_stat.rice.edu>

Date: Fri 21 Apr 2006 - 09:02:02 EST

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 Received on Fri Apr 21 09:07:32 2006

Date: Fri 21 Apr 2006 - 09:02:02 EST

Hello,

Here is a simplified example that would solve my problem.
Imagine I have my data stored in a data frame.

*> x1 <- x2 <- x3 <- x4 <- x5 <- rnorm(20,0,1);
*

> data <- as.data.frame(cbind(x1,x2,x3,x4,x5));

I have a vector containing the variables of interest as such.

*> model.list <- c("x1","x3","x4");
*

*> model.list[1]
*

[1] "x1"

*> floor(model.list[1])
*

Error in floor(model.list[1]) : Non-numeric argument to mathematical
function

*> floor(eval(model.list[1]))
*

Error in floor(eval(model.list[1])) : Non-numeric argument to mathematical
function

*> s <- expression(paste("floor(",model.list[1],")",sep=""))
**> s
*

expression(paste("floor(", model.list[1], ")", sep = ""))

*> eval(s)
*

[1] "floor(x1)"

*>
*

Thanks,

Chad R. Bhatti

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 Received on Fri Apr 21 09:07:32 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 Fri 21 Apr 2006 - 10:10:41 EST.

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