Hi So my particular problem is this:
I have a row vector of length 5200 elements - specifically created by x<-rbinom(5200,1,0.5) y<-matrix(x,nrow=1,ncol=5200) y now, each element is either a 0 or a 1 - e.g. it could be (0,1,1,1,1,0,0,0,1,1,1) e.t.c. when the element is a 1, i need to multiply a number (say 1000) by 1.005, and if it is 1 again, multiply it _again_ by 1.005. so for example, say i have the vector (1,1). it would be 1000 X 1.005 X 1.005 and if the element is 0, then i need to multiply by .995 - i.e. say the vector was (1,1,0) the value would be 1000 X 1.005 X 1.005 X .995. so my questions are these: 1. how do i make R do this automatically for each element and 2. as each term is multiplied, i want to graph the progress of the initial 1000. any help would be greatly appreciated. -- View this message in context: http://n4.nabble.com/R-Problem-using-elements-in-a-vector-tp1774136p1774136.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.