Learn R Programming

prioritizr (version 4.1.5)

loglinear_interpolation: Log-linear interpolation

Description

Log-linearly interpolate values between two thresholds.

Usage

loglinear_interpolation(x, coordinate_one_x, coordinate_one_y,
  coordinate_two_x, coordinate_two_y)

Arguments

x

numeric x values for which interpolate y values.

coordinate_one_x

numeric value for lower x-coordinate.

coordinate_one_y

numeric value for lower y-coordinate.

coordinate_two_x

numeric value for upper x-coordinate.

coordinate_two_y

numeric value for upper y-coordinate.

Value

numeric values.

Details

Values are log-linearly interpolated at the x-coordinates specified in x using the lower and upper coordinate arguments to define the line. Values lesser or greater than these numbers are assigned the minimum and maximum y coordinates.

Examples

Run this code
# NOT RUN {
# create series of x-values
x <- seq(0, 1000)

# interpolate y-values for the x-values given the two reference points:
# (200, 100) and (900, 15)
y <- loglinear_interpolation(x, 200, 100, 900, 15)

# plot the interpolated values
# }
# NOT RUN {
plot(y ~ x)

# add the reference points to the plot (shown in red)
points(x = c(200, 900), y = c(100, 15), pch = 18, col = "red", cex = 2)
# }

Run the code above in your browser using DataLab