auc_trapezoid: Area Under the Curve

View source: R/mutate-auc_trapezoid.R

auc_trapezoidR Documentation

Area Under the Curve

Description

Method trapezoid

Usage

auc_trapezoid(..., time = NULL, na.rm = FALSE)

Arguments

...

value

time

time

na.rm

na.rm

Value

vector

Examples


 dat <-
data.frame(
  t0 = c(1, 1, 1),
  t2 = c(1, 2, 3),
  t3 = c(1, 3, 5),
  t4 = c(1, 3, 6)
)

#apply(dat, 1, function(x)
 # sum(diff(time) * zoo::rollmean(x, 2)))
time = c(0, 1, 2, 3)
auc_trapezoid(1,1,1,1)
auc_trapezoid(dat )
transform(dat, auc= auc_trapezoid( t0, t2, t3, t4, time= time))


stp4/stp25tools documentation built on Feb. 27, 2025, 11:14 p.m.