On Mon, Apr 11, 2011 at 02:05:11PM -0400, Duncan Murdoch wrote:
On 08/04/2011 11:39 AM, Joshua Ulrich wrote:
On Fri, Apr 8, 2011 at 10:15 AM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:
On 08/04/2011 11:08 AM, Joshua Ulrich wrote:
How about:
y- rep(NA,length(x))
which(duplicated(x)==TRUE)
--
View this message in context:
http://r.789695.n4.nabble.com/duplicates-function-tp3436584p3437614.html
Sent from the R devel mailing list archive at Nabble.com.
__
R-devel@r-project.org mailing list
Thanks for your answer, but:
1. can you please cite the question? It is hard for mailing list readers
to follow now.
2. I think
which(duplicated(x))
should be simpler, faster and less confusing, if your code would be the
solution - which is not.
3. Please read the original question carefuly
On 08/04/2011 11:39 AM, Joshua Ulrich wrote:
On Fri, Apr 8, 2011 at 10:15 AM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:
On 08/04/2011 11:08 AM, Joshua Ulrich wrote:
How about:
y- rep(NA,length(x))
y[duplicated(x)]- match(x[duplicated(x)] ,x)
That's a nice solution for vectors.
On Fri, Apr 08, 2011 at 10:59:10AM -0400, Duncan Murdoch wrote:
I need a function which is similar to duplicated(), but instead of
returning TRUE/FALSE, returns indices of which element was duplicated.
That is,
x - c(9,7,9,3,7)
duplicated(x)
[1] FALSE FALSE TRUE FALSE TRUE
I need a function which is similar to duplicated(), but instead of
returning TRUE/FALSE, returns indices of which element was duplicated.
That is,
x - c(9,7,9,3,7)
duplicated(x)
[1] FALSE FALSE TRUE FALSE TRUE
duplicates(x)
[1] NA NA 1 NA 2
(so that I know that element 3 is a
How about:
y - rep(NA,length(x))
y[duplicated(x)] - match(x[duplicated(x)] ,x)
--
Joshua Ulrich | FOSS Trading: www.fosstrading.com
On Fri, Apr 8, 2011 at 9:59 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote:
I need a function which is similar to duplicated(), but instead of returning
On Fri, Apr 8, 2011 at 9:59 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote:
I need a function which is similar to duplicated(), but instead of returning
TRUE/FALSE, returns indices of which element was duplicated. That is,
x - c(9,7,9,3,7)
duplicated(x)
[1] FALSE FALSE TRUE FALSE TRUE
On Fri, Apr 8, 2011 at 11:08 AM, Joshua Ulrich josh.m.ulr...@gmail.com wrote:
How about:
y - rep(NA,length(x))
y[duplicated(x)] - match(x[duplicated(x)] ,x)
I use Joshua's trick all the time. But it might still be nice with a
C implementation.
While we are discussing duplication, I would
On Fri, Apr 8, 2011 at 10:15 AM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:
On 08/04/2011 11:08 AM, Joshua Ulrich wrote:
How about:
y- rep(NA,length(x))
y[duplicated(x)]- match(x[duplicated(x)] ,x)
That's a nice solution for vectors. Unfortunately for me, I have a matrix
(which
-Original Message-
From: r-devel-boun...@r-project.org
[mailto:r-devel-boun...@r-project.org] On Behalf Of Duncan Murdoch
Sent: Friday, April 08, 2011 8:16 AM
To: Joshua Ulrich
Cc: R-devel@r-project.org
Subject: Re: [Rd] duplicates() function
On 08/04/2011 11:08 AM, Joshua
11 matches
Mail list logo