mardi 29 septembre 2015

Error in mutiple if statements

I am writing the following code in R but it gives me an error

S=function(x,a){
if(x<=a) {return (g)}
    else 
        if (a < x <= b) {return(h)}

> Error: unexpected '<=' in:
> "
>    else if (a < x <="
>                   else (return(i))
>    }

How do I correct it?

Aucun commentaire:

Enregistrer un commentaire