Clip values between a minimum and maximum allowed value in R

前端 未结 4 1843
不思量自难忘°
不思量自难忘° 2020-12-13 20:34

In Mathematica there is the command Clip[x, {min, max}] which gives x for min<=x<=max, min for x

4条回答
  •  半阙折子戏
    2020-12-13 21:04

    I believe that would be clamp() from the raster package.

    library(raster)
    clamp(x, lower=-Inf, upper=Inf, ...)
    

提交回复
热议问题