Skip to content
Prev 87254 / 398513 Next

assigning differences in a loop

On Sun, 2006-02-26 at 16:04 -0600, Marc Schwartz wrote:

            
Quick correction here. I accidentally left in the 'newline' in the last
line above. This is a remnant of testing with print(). It should be:

for(i in c("13","26","38")) { 
    for (j in c("HR","PQ","QRS","QT")){
       nam1<-paste("d",j,i,sep="")
       nam2<-paste(j,i,sep=".")
       nam3<-paste(j,"0",sep=".")
       eval(parse(text = paste(nam1, " <- ", nam2, " - ", nam3)))
      }}


Marc