[R] Calculate area under a curve

David Winsemius dwinsemius at comcast.net
Thu Jul 1 19:24:30 CEST 2010


On Jul 1, 2010, at 10:56 AM, suse wrote:

>
> Hi,
>
> I want to know the area under a curve, which is not given as a  
> function, but
> as values in a time series. It is  not a smooth curve, but switches  
> often
> between positive values and zero (the values describe the moisture  
> in the
> soil over a year, one entry is one day). I already tried
> area.between.curves, but got only 0 as result. I guess, it doesn't  
> work
> because of these multiple changes between 0 and positive values  
> (most of the
> time, the values are 0 and in the certain case I tested, the  
> positive values
> were only on single days; but for other values positive values last  
> longer)
> I hope, someone can help me!

?approxfun  # will return a function that you can pass to integrate

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list