Re: [R] counting numbers without replicates in a vector

2004-12-16 Thread Ray Brownrigg
I am just wondering if there is an easy way to count in a numeric vector how many numbers don't have replicates. For example, a=c(1,1,2,2,3,4,5), how can I know there are three numbers (3, 4 and 5) without replicates? How about: length(table(a)[table(a) == 1]) ? Ray Brownrigg

Re: [R] counting numbers without replicates in a vector

2004-12-16 Thread Marc Schwartz
On Thu, 2004-12-16 at 13:40 -0800, Jun Ding wrote: Hi, I am just wondering if there is an easy way to count in a numeric vector how many numbers don't have replicates. For example, a=c(1,1,2,2,3,4,5), how can I know there are three numbers (3, 4 and 5) without replicates? Thank you!

RE: [R] counting numbers without replicates in a vector

2004-12-16 Thread Liaw, Andy
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Thursday, December 16, 2004 5:43 PM To: Ray Brownrigg Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [R] counting numbers without replicates in a vector Ray

[R] counting numbers without replicates in a vector

2004-12-16 Thread Jun Ding
Hi, I am just wondering if there is an easy way to count in a numeric vector how many numbers don't have replicates. For example, a=c(1,1,2,2,3,4,5), how can I know there are three numbers (3, 4 and 5) without replicates? Thank you! Jun = __

Re: [R] counting numbers without replicates in a vector

2004-12-16 Thread Sundar Dorai-Raj
Jun Ding wrote: Hi, I am just wondering if there is an easy way to count in a numeric vector how many numbers don't have replicates. For example, a=c(1,1,2,2,3,4,5), how can I know there are three numbers (3, 4 and 5) without replicates? How about using ?table: tab - table(a) unq -

Re: [R] counting numbers without replicates in a vector

2004-12-16 Thread Jonathan Baron
On 12/16/04 13:40, Jun Ding wrote: Hi, I am just wondering if there is an easy way to count in a numeric vector how many numbers don't have replicates. For example, a=c(1,1,2,2,3,4,5), how can I know there are three numbers (3, 4 and 5) without replicates? Take a look at unique() --

RE: [R] counting numbers without replicates in a vector

2004-12-16 Thread Berton Gunter
PM To: [EMAIL PROTECTED] Subject: [R] counting numbers without replicates in a vector Hi, I am just wondering if there is an easy way to count in a numeric vector how many numbers don't have replicates. For example, a=c(1,1,2,2,3,4,5), how can I know there are three numbers (3, 4 and 5

Re: [R] counting numbers without replicates in a vector

2004-12-16 Thread Yu Shao
table will probably do. The following is probably is what you want: a - c(1,1,2,2,3,4,5) a.tab - table (a) a.tab a 1 2 3 4 5 2 2 1 1 1 as.vector(which (a.tab == 1)) [1] 3 4 5 Cheers, Yu Jun Ding wrote: Hi, I am just wondering if there is an easy way to count in a numeric vector how many