computeLorenzCurve <- function(x, plot = T) { nobs <- length(x) sortedx <- sort(x) abscissa <- (1:nobs)/nobs ordinate <- cumsum(sort(x))/sum(x) if (plot) { plot(ordinate, abscissa, main = "Lorenzkurve") abline(a = 0, b = 1) } return(cbind(abscissa, ordinate)) }