Displaying 1 result from an estimated 1 matches for "greaterof".
Did you mean:
greater
2007 Feb 08
2
Timings of function execution in R [was Re: R in Industry]
...s (can have enormous effects)
> - use function instead of expression
> - use compiled code
> - I guess indexing with numbers (better variables) is also much faster than with text (names) (see also above)
> - I even made, for example, my own min, max, since they are slow, e.g.,
>
> greaterOf <- function(x, y){
> # Returns for each element of x and y (numeric)
> # x or y may be a multiple of the other
> z <- x > y
> z*x + (!z)*y
That's an interesting function. I initially was tempted to respond
that you have managed to reinvent a specialized form of the if...