ยท TECHNOLOGY
Not Using R? Here Is A Very Simple Challenge For You
We came across a very powerful feature in R, called filtering. One application of this is the built-in function 'which'. Here is an example: if you would like to find the positions within a vector z that satisfy a certain condition, say the square of the number is greater than 8, here is the code:
which(z*z > 8)
that is it. so if z <- c(5,2,-3,8), the above code would return 1 3 4 - basically the positions in the vector which satisfy the condition mentioned (z*z > 8). (Example Source)
How would you do this in your programming language?