Re: [R] Frequency vector

2008-08-15 Thread emir.toktar
b= tabulate(a) > b [1] 4 1 1 1 2 > print(b[1]) [1] 4 Emir Toktar > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of dennis11 > Sent: Tuesday, August 12, 2008 5:21 AM > To: r-help@r-project.org > Subject: [R] Frequency ve

Re: [R] Frequency vector

2008-08-12 Thread Dan Davison
On Tue, Aug 12, 2008 at 01:21:29AM -0700, dennis11 wrote: > > I want to create a vecor with frequencies. > > I have tried this: > > a <- c(1,1,1,1,2,3,4,5,5) > b <- table(a) > print (b[1]) > > which results in: > > print (b[1]) > 1 > 4 > > The only thing I want is the 4. > > So this seems

Re: [R] Frequency vector

2008-08-12 Thread Michael R. Head
On Tue, 2008-08-12 at 01:21 -0700, dennis11 wrote: > I want to create a vecor with frequencies. > > I have tried this: > > a <- c(1,1,1,1,2,3,4,5,5) > b <- table(a) > print (b[1]) > > which results in: > > print (b[1]) > 1 > 4 > The only thing I want is the 4. Isn't this one if the situation

[R] Frequency vector

2008-08-12 Thread dennis11
I want to create a vecor with frequencies. I have tried this: a <- c(1,1,1,1,2,3,4,5,5) b <- table(a) print (b[1]) which results in: > print (b[1]) 1 4 The only thing I want is the 4. So this seems obvious: print (b[1,2]) but it does not work: Error in b[1, 2] : incorrect number of dimens

Re: [R] Frequency vector

2008-08-12 Thread David Carslaw
how about: a <- c(1,1,1,1,2,3,4,5,5) b <- as.data.frame(table(a)) b a Freq 1 14 2 21 3 31 4 41 5 52 which you can then select the bits you want from. David dennis11 wrote: > > I want to create a vecor with frequencies. > > I have tried this: > > a <- c(1,1,1,1,2,3,