Skip to contents

Function to estimate the area under a curve given as x and y(x) values

Usage

low.integrate(x, y)

Arguments

x

Numeric vector of x values.

y

Numeric vector of y values with the same length as x.

Value

Numeric value: Area under the smoothed spline.

Details

The function uses the the R internal function smooth.spline.

See also

Examples

# Create random growth dataset
rnd.dataset <- rdm.data(d = 35, mu = 0.8, A = 5, label = 'Test1')

# Extract time and growth data for single sample
time <- rnd.dataset$time[1,]
data <- as.numeric(rnd.dataset$data[1,-(1:3)]) # Remove identifier columns

plot(time, data)


print(low.integrate(time, data))
#> [1] 88.6072