Quantcast
Channel: Working with multiple if else statements - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Working with multiple if else statements

$
0
0

I cannot figure out what I need. Here is simplification what I actually need.

I would like to process each function if certain number appears in a vector,here is example:

v <- c(111,88,222,99,555,1,9,6)if(111 %in% v){   x <- 111+0.1 } else if(222 %in% v){   y <- 222+0.1 } else if(555 %in% v){   z <- 555+0.1 }

I would like to process each function if given number is found in vector v.

In the above example the if else example would give out number 111.1,222.1,333.1, what I'm doing wrong here?

Basicaly, I would like to calculate each function if certain number appears in vector.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images