Hello group,
I’m trying to translate a program written in the R language into Mathematica.
R is a statistical language and is similar to Mathematica in many respects.
There is one command called ifelse(test, result if true, result if false) that operates on two lists.
What it does in this instance is to generate a list A from the two lists ca and p:
A=ifelse(abs(ca) > p, sign(ca),0)
The resulting list A contains the sign of a value in the list ca if the absolute value of the element ca is greater than the
corresponding value of the element in list p (p is all positive values), and 0 otherwise.
I haven’t been able to do this in Mathematica without going to a Do procedural command. Is there a
rule based command for doing this?
John Reed