s-news
[Top] [All Lists]

avoiding a loop in Splus

To: <s-news@lists.biostat.wustl.edu>
Subject: avoiding a loop in Splus
From: "Leeds, Mark" <mleeds@mlp.com>
Date: Thu, 28 Oct 2004 06:53:42 -0400
Thread-index: AcS83GPmwkXPzQoFQAqRN6hT7r78Kg==
Thread-topic: avoiding a loop in Splus
does anyone know if it's possible
to modify the function below to
avoid the loop ? i think
i am pretty good at avoiding
loops in Splus but i can't
figure this one out.
 
=================================
 
constructLt<-function(invector) {
 
outvector_as.vector(length(invector))
outvector_invector
 
for ( i in 2:length(invector) ) {
 
if ( invector[i] < 1 )  {
outvector[i]_invector[i]*outvector[i-1]
}
}
 
return(outvector)
 
 
==================================
<Prev in Thread] Current Thread [Next in Thread>