This function computes the area under the curve for two vectors where one corresponds to the x values and the other corresponds to the y values. It supports both linear and spline interpolation.
auc(
x,
y,
from = min(x, na.rm = TRUE),
to = max(x, na.rm = TRUE),
type = c("linear", "spline"),
subdivisions = 100,
...
)
A numeric value representing the area under the curve.
A numeric vector of x values.
A numeric vector of y values of the same length as x.
The value from where to start calculating the area under the curve. Defaults to the smallest x value.
The value from where to end the calculation of the area under the curve. Defaults to the greatest x value.
The type of interpolation: "linear" or "spline". Defaults to "linear".
An integer indicating how many subdivisions to use for `integrate` (for spline-based approximations).
Additional arguments passed on to `approx` (for linear interpolations).