integrate_area: Integrate area

View source: R/integrate_area.R

integrate_areaR Documentation

Integrate area

Description

Integrate the area under a xy plot. Credit to StackOverflow The method used here is to sum the area of mutiple trapeziums under a line.

Usage

integrate_area(df, x, y, skip.na = TRUE)

Arguments

df

Data frame containing x and y of a plot.

x

Column name for the x axis.

y

Column name for the y axis.

skip.na

Logical. How to treat NAs in y. If TRUE the trapezium of the area adjacent to the missing value will be calculated. If FALSE the two trapeziums before and after the missing value will be NA.

Value

A value of the area.


MohoWu/ricardor documentation built on March 24, 2022, 4:39 p.m.