Hi,

I've been trying to rank stocks by month/time period. The code I have below is ranking each stock over its range, instead of going across and ranking row by row



symbols= c("GE","XOM","GOOG","XLU")
getSymbols(symbols, src='yahoo', index.class=c("POSIXt","POSIXct"), from='2005-01-01')

for(symbolinsymbols) {
    x<-get(symbol)
    x<-to.monthly(x,indexAt='lastof',drop.time=TRUE)
    indexFormat(x)<-'%Y-%m-%d'
    colnames(x)<-gsub("x",symbol,colnames(x))
    assign(symbol,x)
}

data<-cbind(Cl(GE),Cl(XOM),Cl(GOOG),Cl(XLU))

NewVar<-cut(x,quantile(x,(0:10)/10),include.lowest=TRUE)



How do I modify this so that I get the ranks for each time stamp?

Thanks!

Gaurav M
	[[alternative HTML version deleted]]

