R/weightSM.R

"weightSM" <-
  function(weight, typ, sm, pt) {
    # weightSM
    if (typ == 0) {
      if (pt < weight[1]) {
        lina <- approxfun(
          c(weight[1], weight[1] - sm),
          c(weight[3], 1)
        )
        weight[3] <- lina(pt)
      } else {
        lina <- approxfun(
          c(weight[1], weight[2] + sm),
          c(weight[3], 1)
        )
        weight[3] <- lina(pt)
      }
    }

    weight[3]
  }

Try the TIMP package in your browser

Any scripts or data that you put into this service are public.

TIMP documentation built on Dec. 28, 2022, 3:06 a.m.