Re: [R] Assignment to variables fails to loop

2009-03-27 Thread jim holtman
Look at what paste("Fekete_",index$year, index$month, sep='') is creating in the 'assign'; it is a character vector that have the same value each time through the loop. What you may want to do is something like this: index <- expand.grid(year = sprintf("%04d", seq(1986, 1995)), month = sprintf(

Re: [R] Assignment to variables fails to loop

2009-03-27 Thread baptiste auguie
The variable name in your call to assign should vary within the for loop, otherwise you're always assigning the value to the same variable. Consider the following example, listOfNames <- c("a", "b", "c") listOfVariables <- c("vara", "varb", "varc") for(index in seq_along(listOfNames)){