You can do anything pretty easily with R, for instance, calculate concentration indexes such as the Gini index or display the Lorenz curve (dedicated to my students).
Although I did not explain it during my lectures, calculating a Gini index or displaying the Lorenz curve can be done very easily with R. All you have to do is to figure out which of the billions packages available on CRAN (ok, only 3,629 packages to be honest) will give you the answer (and for that, Google can help you: just try to google “r cran gini” and you should be able to find by yourself a few answers).
One of the packages that can do it is
ineq that you can install in R by using the command line (or by whichever alternative method you want):
The package should be loaded in R by
and then, you can start to use it. I’ll show a very simple example of its use for the concepts that I have taught during the first year lectures. The example is based on the data
AirPassengers that you may load by simply typing:
(these data are the monthly totals of international airline passengers, from 1949 to 1960 and are thus relevant enough for a concentration analysis).
The Gini index of the distribution can be calculated by:
ineq(AirPassengers,type="Gini")  0.2407563
help(ineq) for more advanced features)
The Lorenz curve is displayed by