Message-ID: <1296100537216-3241432.post@n4.nabble.com>
Date: 2011-01-27T03:55:37Z
From: Pete Brecknock
Subject: How do I fix this ?
In-Reply-To: <1296092713427-3239239.post@n4.nabble.com>
Eric
Your problem lies in the way cumprod deals with NAs
If you look at ?cumprod you will see
"An NA value in x causes the corresponding and following elements of the
return value to be NA"
Not sure what behaviour you want to see on encountering an NA (ignore it,
restart the cumprod process, .....). Making things easy for myself (it's
late), if you wish to simply ignore an NA the following would work
# sample data
y2=c(NA,1,2,3,4,5)
# ignore NA
ave(y2,is.na(y2),FUN=cumprod)
HTH
Pete
--
View this message in context: http://r.789695.n4.nabble.com/How-do-I-fix-this-tp3239239p3241432.html
Sent from the R help mailing list archive at Nabble.com.