R - avoid ifelse

26 Aug 2017

ifelse is known to be slow; instead of writing:

ifelse(female, 1.25, 0.75), write

prefer:

p + 0.75 + 0.5 * female
[ R  logic  ]