Hello all:

I have a data series of 500 data, and I want to limit the value of it to be
less than 1.
Below is my code:

>for (i in 1:500)
+if( x[i] > 1)
+x[i] = 1

but the system told me it's wrong. Can anyone told me the reason?


-----
------------------------------------------------------------------
Saji Ren
from Shanghai China
GoldenHeart Investment Group
------------------------------------------------------------------
-- 
View this message in context: 
http://r.789695.n4.nabble.com/How-to-perform-a-substitution-in-a-loop-tp2325048p2325048.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.

Reply via email to