79447756

Date: 2025-02-18 09:42:04
Score: 1
Natty:
Report link

A bit late to the party... but there is no need for external packages. approx actually does achieve what you want. What you want is to interpolate only between the min and max values, so simply do:

approx(range(s), c(0,1), s)$y

or equivalently,

approxfun(range(s), c(0,1))(s)
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Terry WS Chan