Re: [R] Function Gini or Ineq

2010-09-04 Thread Karen Kotschy
Hi Marcio You might like to look at some equivalents from the field of ecology, for which there are existing functions. Have a look at the function "diversity" in the package "vegan". This provides the Simpson diversity index, which is the complement of the Gini coefficient (Gini = 1 - Simpson

Re: [R] Function Gini or Ineq

2010-09-03 Thread John Kane
gini(x) --- On Fri, 9/3/10, Mestat wrote: > From: Mestat > Subject: Re: [R] Function Gini or Ineq > To: r-help@r-project.org > Received: Friday, September 3, 2010, 1:07 PM > > Hi Peng, > I did that i installed the package RELDIST, but nothing > happene

Re: [R] Function Gini or Ineq

2010-09-03 Thread Mestat
Hi Peng, I did that i installed the package RELDIST, but nothing happened. R does not recognize this function. Still looking for the solution. Thanks, Marcio -- View this message in context: http://r.789695.n4.nabble.com/Function-Gini-or-Ineq-tp2525852p2525981.html Sent from the R help mailing l

Re: [R] Function Gini or Ineq

2010-09-03 Thread Peng, C
you need install and load package {reldist} before you call function gini(). HTH. -- View this message in context: http://r.789695.n4.nabble.com/Function-Gini-or-Ineq-tp2525852p2525966.html Sent from the R help mailing list archive at Nabble.com. __ R

Re: [R] Function Gini or Ineq

2010-09-03 Thread Mestat
Hi Dimitris, I have already seen your code in another post. But, I would like to weight my data. So, I wish I could use the following command: gini(x, weights=rep(1,length=length(x))) Thanks anyway and I am trying to understand your gini function in order to apply a weigth. Marcio -- View this

Re: [R] Function Gini or Ineq

2010-09-03 Thread Dimitris Rizopoulos
for the Gini coefficient you can use this function: gini <- function(x, unbiased = TRUE, na.rm = FALSE){ if (!is.numeric(x)) { warning("'x' is not numeric; returning NA") return(as.numeric(NA)) } if (any(na.ind <- is.na(x))) { if (!na.rm) stop("'x'

[R] Function Gini or Ineq

2010-09-03 Thread Mestat
Hi listers, Does it necessary to install any package in order to use the GINI or INEQ functions. If I use the following command the R tells me that didn't find the GINI function. x<-c(541, 1463, 2445, 3438, 4437, 5401, 6392, 8304, 11904, 22261) G<-gini(x) Thanks in advance, Marcio -- View this