Skip to content
Back to formatted view

Raw Message

Message-ID: <1140992440.4506.23.camel@localhost.localdomain>
Date: 2006-02-26T22:20:40Z
From: Marc Schwartz
Subject: assigning differences in a loop
In-Reply-To: <1140991448.4506.19.camel@localhost.localdomain>

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

> Lacking your data, which I presume is ECG measurement information from
> the acronyms in use, you could do something like this:
> 
> 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,  "\n")))
>       }}

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