Learn R Programming

hedgehog (version 0.1)

shrink.towards: Shrink an integral number by edging towards a destination.

Description

Note we always try the destination first, as that is the optimal shrink.

Usage

shrink.towards(destination)

Arguments

destination

the value we want to shrink towards.

Examples

Run this code
shrink.towards (0) (100)
# [0,50,75,88,94,97,99]

shrink.towards(500)(1000)
# [500,750,875,938,969,985,993,997,999]

shrink.towards (-50) (-26)
# [-50,-38,-32,-29,-27]

Run the code above in your browser using DataLab