[R] Looping Problem

armstrwa William.Armstrong at noaa.gov
Tue Mar 22 18:05:37 CET 2011


Hi all,

I am trying to write a script that will automate the task of running a
Kendall's Tau correlation test on 75 time series that I am interested in.  

The code I have written is:

for(i in 1:length(gagehandles)){
dates<-get(paste(gagehandles[i],"_amsd",sep=""))
q<-get(paste(gagehandles[i],"_amsq",sep=""))

taup<-Kendall(dates,q)
print(gagehandles[i])
print(taup)

So basically, I have inputted all the records I am concerned with into R
using the scan function.  These are all represented by a four letter
identifier followed by _amsd or _amsq (to distinguish the two variables). 
For example, a variable might be hoea_amsd, which has a corresponding
hoea_amsq.

I am trying to write a function that will run through a list of the gage
identifiers ('gagehandles' in the code) and will then runn and Kendall's tau
correlation test on the two variables (suffixes '_amsd' and '_amsq').

It was working when I was using a small subset of my data, but now that I am
trying to look at all 75 series, I am getting the error:

Error in get(paste(gagehandles[i], "_amsd", sep = "")) : 
  variable names are limited to 256 bytes

It didn't have a problem with the variable names before, so I'm not sure
what's going on now.  Does anyone have an idea?

Thank you very much for your help.

Billy

--
View this message in context: http://r.789695.n4.nabble.com/Looping-Problem-tp3397077p3397077.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list