Message-ID: <1304044109664-3482737.post@n4.nabble.com>
Date: 2011-04-29T02:28:29Z
From: eric
Subject: why doesn't ifelse work ?
In-Reply-To: <20110429022443.GD48756@ms.unimelb.edu.au>
equire(quantmod)
require(PerformanceAnalytics)
rm(list=ls())
getSymbols("^GSPC", src="yahoo", from="1990-01-01", to=Sys.Date())
GSPC <-na.omit(Ad(GSPC))
ind <- rollapply(GSPC, 200, mean)
signal <- ifelse(diff(ind, 5) > 0 , 1 , -1)
signal[is.na(signal)] <- 0
--
View this message in context: http://r.789695.n4.nabble.com/why-doesn-t-ifelse-work-tp3482680p3482737.html
Sent from the R help mailing list archive at Nabble.com.