Hi
 
I am trying to loop over some data while changing the variable names. 
 
My code right now looks like
 
months<-c(5,4,8,1,9,7,6,2,12,11,10,3)
mnth_nme<-c("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec")
a<-1
 
for (i in months)
{
  had_1990<-raster(prec,months)
  had_2040<-raster(tot_40,months)
  had_2090<-raster(tot_90,months)
  
#all the month data
  paste(mnth_nme[a],"_ppt",sep="")<-stack(had_1990,had_2040,had_2090)### this  is where it breaks down. 
  a<-a+1
  }
 
Basically I want to end up with each month's data stacked and called jan_ppt, feb_ppt.... 
 
I tried to google the solution and people seem to suggest lists but when I tried to make a list I got another error and I am not sure what I am doing wrong
 > months<-c(5,4,8,1,9,7,6,2,12,11,10,3) > mnth_nme<-c("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec") > a<-1 > mnth <- list() > for(i in mnth_nme) + { + mnth[[paste(mnth_nme[a]"_ppt",sep="")]] Error: unexpected string constant in:
"{
mnth[[paste(mnth_nme[a]"_ppt""
 
Any explanation would be very helpful. Thanks
 
KJ
	[[alternative HTML version deleted]]

