Community Tip - You can change your system assigned username to something more personal in your community settings. X
I have a vector of values and I would like to compare all these values inluced in the table in order to know if it is higher than 1.
I was thinking to use "if" but I don't know how to use it.
Use A > 1 and you get a vector of 0's and 1's where a 1 (= TRUE) denotes an entry which is greater than 1.
If you insist that you want to see "OK" (and you have to provide a text/return value if the entry is smaller or equal to 1), you may define a function which expects a single scalar and returns those texts and call that function vectorized(!) with your vector A as argument.
I used the if-function when I defined the function "compare", but you may as well use the programmed if-statement instead
The reason we need to define a function is that Prime does not allow to vectorize the comparison operator, but it allows to vectorize the call of a function which uses that operator 😉
Hi,
Once you have the truth table of zeros and ones it is possible to trim out the zeros like this.