Displaying 1 result from an estimated 1 matches for "maxcost".
Did you mean:
macosx
2012 Jul 23
2
Bug in my code (finding nonzero min)
...ng budget of 10, portfolio cost 6,
cheapest availabe stock 3 despite the diff variable being negative.
Any ideas?
y<-1-new.set[,6:26]
remain<-y*data3[,5]
minn<-matrix(0,nrow(remain),1)
for(q in 1:nrow(remain))
{
remainc<-remain[q,]
minn[q,]<-min(remainc[which(remainc>0)])
}
maxcost<-matrix(150,nrow(new.set),1)
diff<-maxcost[,1]-new.set[,5]-minn[,1]
new.set<-subset(new.set,diff<0)
--
View this message in context: http://r.789695.n4.nabble.com/Bug-in-my-code-finding-nonzero-min-tp4637399.html
Sent from the R help mailing list archive at Nabble.com.