I am trying to create an indictor variable, Z, in R, i.e If I have some event A, I want Z to give a result of 1 if A is true and 0 if A is false. I have tried this:
Z=0
if(A==(d>=5 && d<=10))
{
Z=1
}
else
{
Z=0
}
But this doesn't work. I was also thinking i could try to write a separate function called indicator:
indicator = function()
Any suggestions would be really helpful, thank you