Re: [R] How to count the number of different elements in a column

2012-11-26 Thread Hard Core
Yes, I'm sorry ... i was checking for another column so i made a mistake. Thank you people ;) -- View this message in context: http://r.789695.n4.nabble.com/How-to-count-the-number-of-different-elements-in-a-column-tp4650825p4650875.html Sent from the R help mailing list archive at Nabble.

Re: [R] How to count the number of different elements in a column

2012-11-26 Thread Rui Barradas
Hello, You're wrong, unique doesn't count unique returns a vector without repetitions. unique(a) # includes 1 and 4 [1] 1 2 3 6 7 8 4 length(unique(a)) [1] 7 Hope this helps, Rui Barradas Em 26-11-2012 14:55, Hard Core escreveu: this is wrong because with the command "unique" it counts th

Re: [R] How to count the number of different elements in a column

2012-11-26 Thread Jose Iparraguirre
020 303 31482 E jose.iparragui...@ageuk.org.uk -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Hard Core Sent: 26 November 2012 10:20 To: r-help@r-project.org Subject: [R] How to count the number of different elements in a column Hello, Sup

Re: [R] How to count the number of different elements in a column

2012-11-26 Thread Sarah Goslee
> x <- c(1, 2, 3, 1, 6, 7, 8, 3, 4, 4) > length(unique(x)) [1] 7 On Mon, Nov 26, 2012 at 5:20 AM, Hard Core wrote: > Hello, > Suppose that i have a dataframe > a <- read.dta("banca_impresa.dta") > > i have a column with 17900 obs like > > 1 > 2 > 3 > 1 > 6 > 7 > 8 > 3 > 4 > 4 > > and i want to kn

Re: [R] How to count the number of different elements in a column

2012-11-26 Thread chuck.01
My apologies. I still do not understand the difference; good luck. Hard Core wrote > this is wrong because with the command "unique" it counts the only values > that are unique .. > > in my column, for instance, 1 and 4 are not unique so the formula doesn't > work in my case -- View this m

Re: [R] How to count the number of different elements in a column

2012-11-26 Thread chuck.01
length(unique(a)) Hard Core wrote > Hello, > Suppose that i have a dataframe > a <- read.dta("banca_impresa.dta") > > i have a column with 17900 obs like > > 1 > 2 > 3 > 1 > 6 > 7 > 8 > 3 > 4 > 4 > > and i want to know the number of the different values so in this case it > would be 7 > Ho

Re: [R] How to count the number of different elements in a column

2012-11-26 Thread Hard Core
this is wrong because with the command "unique" it counts the only values that are unique .. in my column, for instance, 1 and 4 are not unique so the formula doesn't work in my case -- View this message in context: http://r.789695.n4.nabble.com/How-to-count-the-number-of-different-elements-i

[R] How to count the number of different elements in a column

2012-11-26 Thread Hard Core
Hello, Suppose that i have a dataframe a <- read.dta("banca_impresa.dta") i have a column with 17900 obs like 1 2 3 1 6 7 8 3 4 4 and i want to know the number of the different values so in this case it would be 7 How can i do? Thank you -- View this message in context: http://r.789695.n4