EDIT: gini() in the reldist package also works.
Installing and loading the Library
Download and install
Now load the library
I have a frequency list which looks a bit like this
# user_posts.txt user posts jose 2342 BonQuisha 1564 Kisha 1198 ... ... Takiera 2 Tramicia 1 Watermelondrea 1
so we load the file to a data frame.
> df <- read.csv('path/to_the_file/user_posts.txt',sep='\t')
The “posts” column contains the data that we want to analyse.
We want to do two things, first, calculate the Gini Index (or coefficient), and the second is to plot a Lorenz curve.
This is as simple as it gets
> ineq(df$posts,type='Gini') # and that returns  0.8724686
Lorenz Curve Plot
Again, this cannot be any simpler…
and that should give us something pretty basic like this
Which is nice and all, but we can always make it better by changing the labels, title and lines.
> plot(Lc(df$subs), xlab="User Percentile", ylab="Post Percentage", main="Participation Inequality", col="blue", )
Now we get a much nicer graph