R/simpson.R

Defines functions `simpson`

`simpson` <-
function(x,y) 
{
ai<-(y[y>0]-x[y>0])!=y[y>0]
a<-length(ai[ai==TRUE])
if (a!= 0) {
b <- length(x[x > 0])
c <- length(y[y > 0])
simp <- a/min(b, c)
}
else simp <- 0
return(simp)
}

Try the fossil package in your browser

Any scripts or data that you put into this service are public.

fossil documentation built on March 23, 2020, 5:06 p.m.