Indicator function in R

前端 未结 4 1772
礼貌的吻别
礼貌的吻别 2020-12-19 07:53

I\'m looking for an indicator function in R, i.e. a function that returns a 1, if the value of an element in a vector is greater than 0 and returns zero, if the value of an

4条回答
  •  半阙折子戏
    2020-12-19 08:27

    There is also an built-in indicator function in R

    Indicator(x,min,max)

    -Inf and Inf are still the valid values.

提交回复
热议问题