gt; >
> > -----Original Message-----
> > From: r-help-boun...@r-project.org
> > [mailto:r-help-boun...@r-project.org] On Behalf Of Henrique
> > Dallazuanna
> > Sent: Friday, February 26, 2010 9:47 AM
> > To: Ran
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of sjaffe
> Sent: Thursday, March 04, 2010 10:59 AM
> To: r-help@r-project.org
> Subject: Re: [R] counting the number of ones in a vector
>
>
> I got ti
I got tired of writing length(which()) so I define a useful function which I
source in my .Rprofile:
count <- function( x ) length(which(x))
Then:
count( x == 1 )
--
View this message in context:
http://n4.nabble.com/counting-the-number-of-ones-in-a-vector-tp1570700p1578549.html
Sent from t
t; [1] 4
>
>
>
>
>
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Henrique
> Dallazuanna
>
2010 3:03 PM
To: Nutter, Benjamin; Henrique Dallazuanna; Tobias Verbeke; David Reinke;
Gavin Simpson
Cc: r-help@r-project.org
Subject: Re: [R] counting the number of ones in a vector
Thanks to all of you !
(Benjamin Nutter, Henrique Dallazuanna, Tobias Verbeke, Jorge Ivan Velez,
David Reinke and Gavin
]
> On Behalf Of Henrique Dallazuanna
> Sent: Friday, February 26, 2010 9:47 AM
> To: Randall Wrong
> Cc: r-help@r-project.org
> Subject: Re: [R] counting the number of ones in a vector
>
> Try:
>
> sum(x == 1)
>
> On Fri, Feb 26, 2010 at 11:40 AM, Randall Wrong
to:r-help-boun...@r-project.org] On
> Behalf Of Randall Wrong
> Sent: Friday, February 26, 2010 6:44 AM
> To: r-help@r-project.org
> Subject: [R] counting the number of ones in a vector
>
> Dear R users,
>
> I want to count the number of ones in a vector x.
>
> T
Wrong
Sent: Friday, February 26, 2010 6:44 AM
To: r-help@r-project.org
Subject: [R] counting the number of ones in a vector
Dear R users,
I want to count the number of ones in a vector x.
That's what I did : length( x[x==1] )
Is that a good solution ?
Thank you very much,
Ra
February 26, 2010 9:47 AM
To: Randall Wrong
Cc: r-help@r-project.org
Subject: Re: [R] counting the number of ones in a vector
Try:
sum(x == 1)
On Fri, Feb 26, 2010 at 11:40 AM, Randall Wrong wrote:
> Dear R users,
>
> I want to count the number of ones in a vector x.
>
> T
Hi Randall,
Try also
sum( x==1 )
HTH,
Jorge
On Fri, Feb 26, 2010 at 9:40 AM, Randall Wrong <> wrote:
> Dear R users,
>
> I want to count the number of ones in a vector x.
>
> That's what I did : length( x[x==1] )
>
> Is that a good solution ?
> Thank you very much,
> Randall
>
>[[alte
Hi Randall,
Try also
sum( x==1 )
HTH,
Jorge
On Fri, Feb 26, 2010 at 9:40 AM, Randall Wrong <> wrote:
> Dear R users,
>
> I want to count the number of ones in a vector x.
>
> That's what I did : length( x[x==1] )
>
> Is that a good solution ?
> Thank you very much,
> Randall
>
>[[alte
10 9:41 AM
To: r-help@r-project.org
Subject: [R] counting the number of ones in a vector
Dear R users,
I want to count the number of ones in a vector x.
That's what I did : length( x[x==1] )
Is that a good solution ?
Thank you very much,
Randall
[[alternative HTML
Try:
sum(x == 1)
On Fri, Feb 26, 2010 at 11:40 AM, Randall Wrong wrote:
> Dear R users,
>
> I want to count the number of ones in a vector x.
>
> That's what I did : length( x[x==1] )
>
> Is that a good solution ?
> Thank you very much,
> Randall
>
> [[alternative HTML version deleted]]
>
Dear R users,
I want to count the number of ones in a vector x.
That's what I did : length( x[x==1] )
Is that a good solution ?
Thank you very much,
Randall
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://s
unting the number of ones in a vector
Dear R users,
I want to count the number of ones in a vector x.
That's what I did : length( x[x==1] )
Is that a good solution ?
Thank you very much,
Randall
[[alternative HTML version deleted]]
__
R-hel
Dear R users,
I want to count the number of ones in a vector x.
That's what I did : length( x[x==1] )
Is that a good solution ?
Thank you very much,
Randall
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://sta
16 matches
Mail list logo