RE: [R] evaluating and walking in names

2003-08-14 Thread Ted Harding
On 06-Aug-03 Cezar Augusto de Freitas Anselmo wrote: Hi, all. Suppose I have an object with names (like a data.frame) and I want to walk in a loop with your names. How can I do this? The idea is like this: my.data-data.frame(matrix(runif(6),ncol=2)) names(my.data) [1] X1 X2 for(i in

RE: [R] evaluating and walking in names

2003-08-11 Thread Thomas Lumley
On Wed, 6 Aug 2003 [EMAIL PROTECTED] wrote: QUESTION TO EXPERTS: While (a construction I've often used successfully): for(Z in c(X1,X2,X3)){ Z-eval(as.name(Z)) do.something.with(Z) } works, going through the variables named X1, X2, X3 in turn, when I was trying to clean up