Here is an email sent by one of my students a few days ago: Do you know how to integrate a function with an “if”? For instance: >X=rnorm(100) >Femp=function(x){ + return(sum(X<x)) +} >integrate(Femp,0,1)$value does not work. My reply was that the fundamental reason it does not work is that integrate (or curve for instance)