I am new in R.....I dont know...why it doesnt work(((

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

I am new in R.....I dont know...why it doesnt work(((

Rlotus
This post has NOT been accepted by the mailing list yet.
The goal of my code is that user has to type numbers.... if number is equil to 0 then code has to print 1/9, or if it is 2 or 7 then print retVal 0. In other cases just to print 1/10;
My code does not work at all((( plz help me((

probability = c(1/10,2/5,1/10,1/10,1/10,1/10,1/10);

O2sat=as.numeric(readline("Type a number please"))
dsidp = function(x){
        retval=0;
        if (x=0) then retVal=1/9
        else if (x=2) then retVal=0
        else if (x=7) then retval=0 else retVal = 1/10;
        print(retVal);
}