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)){

[R] Assignment to variables fails to loop

2009-03-27 Thread Steve Murray
Dear all, I think I'm nearly there in writing R code which will read in files with two variable parts to the file name and then assigning these file names to objects, which also have two variable parts. I have got the code running without encountering errors, however, I receive 50+ of the same