Re: [R] accessing variables inside a function, inside a loop

2011-03-01 Thread Joshua Wiley
Hi Alan, Other more knowledgeable people may have better opinions on this than I do. Manipulating language and call objects is seriously stretching my skills. \ In any case, two ways come to mind, both of them sufficiently cumbersome I would seriously question the value (btw, this is a complete

Re: [R] accessing variables inside a function, inside a loop

2011-03-01 Thread zListserv
Joshua Great solution. Taking off on your code, the following works but does not display the names of the variables in the formula. Any suggestions about how to modify the function so that it displays the correct formula (e.g., "glm(formula = y1 ~ x1 * x2, data = dat)" instead of "glm(formula

Re: [R] accessing variables inside a function, inside a loop

2011-02-27 Thread Joshua Wiley
Dear Sacha, That is the most piteous soliloquy I have read in some time. Here then a response to soothe your dizzied mind and wrest your rest from the ornery sprites that so threaten to plague it now. ## Some sample data water <- as.data.frame(matrix(rnorm(120), ncol = 12)) ## Adding your names

Re: [R] accessing variables inside a function, inside a loop

2011-02-27 Thread jim holtman
A quick look says you are passing N_Male in which is a vector of values, but you are trying to use it as if it were a character value in: y <- DATA[[y]] try calling it with comp.plot(i,"N_male",DATA=water) Also get out of the habit of using 'attach'; it can lead to other issues. On Sun, Feb 27

[R] accessing variables inside a function, inside a loop

2011-02-27 Thread Sacha Viquerat
dear list! I KNOW this has been answered a million times before. But, as some might remember from their "freelance" times as a statistic consultant, sometimes you're blinded by the facts. I KNOW I have seen this problem solved, but due to the mental blockade i have been suffering from the last