Skip to content
Prev 165997 / 398502 Next

if statement

Hi,

How do I check for two conditions in an if loop? I want to check if a value
lies between 2 other values.

For example, 

A <- ts(rnorm(120), freq=12, start=c(1992,8))
X <- 0.5
Y <- 0.8

I would like to create a new vector C for which C[i] is 0 if A[i] lies in
between X and Y. 

Would be grateful for any help. Sorry for asking such an R-newbie question! 

Shruthi