Trapezoidal rule - Hmisc [🇷 for BE/BA]

posted by d_labes  – Berlin, Germany, 2010-04-19 15:41 (5542 d 02:13 ago) – Posting: # 5168
Views: 10,297

Dear All,

just discovered in Frank Harrels library (package) Hmisc:
Area under curve defined by arbitrary x and y vectors, using trapezoidal rule and assuming x sorted appropriately

trap.rule <- function(x, y) sum(diff(x) * (y[-1] + y[-length(y)]))/2

Wow :ok:! The cream of the crop of programming art!

Regards,

Detlew

Complete thread:

UA Flag
Activity
 Admin contact
23,424 posts in 4,927 threads, 1,672 registered users;
44 visitors (0 registered, 44 guests [including 11 identified bots]).
Forum time: 17:54 CEST (Europe/Vienna)

Medical researches can be divided into two sorts:
those who think that meta is better and those
who believe that pooling is fooling.    Stephen Senn

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5