[R] if statement

Carlos J. Gil Bellosta cgb at datanalytics.com
Mon Jan 5 12:55:10 CET 2009


Hello,

If you do

C <- A
C[A > X & A < Y] <- 0

you get what it seems you want.

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.com

On Mon, 2009-01-05 at 03:41 -0800, Shruthi Jayaram wrote:
> A <- ts(rnorm(120), freq=12, start=c(1992,8))
> X <- 0.5
> Y <- 0.8




More information about the R-help mailing list