map_value: Map a value in one range to a value in another

View source: R/utils.R

map_valueR Documentation

Map a value in one range to a value in another

Description

Map a value in one range to a value in another

Usage

map_value(x, old_min, old_max, new_min, new_max)

Arguments

x

numeric. Value to be transformed

old_min

numeric. Minimum value of source range.

old_max

numeric. Maximum value of source range.

new_min

numeric. Minimum value of desired range.

new_max

numeric. Maximum value of desired range.

Value

Value of x mapped to the desired range.

Examples

# Map values from the range 0-10 to the range 0-1
map_value(c(0, 1, 2, 3), 0, 10, 0, 1)

jcalendo/coriell documentation built on March 5, 2025, 5:42 a.m.