[R] Looping Problem

From: armstrwa <William.Armstrong_at_noaa.gov>
Date: Tue, 22 Mar 2011 10:05:37 -0700 (PDT)

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=""))


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.


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.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 22 Mar 2011 - 17:08:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 22 Mar 2011 - 18:40:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive