Re: [R] counting the number of ones in a vector

2010-03-09 Thread Randall Wrong
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

Re: [R] counting the number of ones in a vector

2010-03-04 Thread Nordlund, Dan (DSHS/RDA)
> -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

Re: [R] counting the number of ones in a vector

2010-03-04 Thread sjaffe
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

Re: [R] counting the number of ones in a vector

2010-03-04 Thread Gavin Simpson
t; [1] 4 > > > > > > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Henrique > Dallazuanna >

Re: [R] counting the number of ones in a vector

2010-03-03 Thread Bert Gunter
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

Re: [R] counting the number of ones in a vector

2010-03-03 Thread Randall Wrong
] > 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

Re: [R] counting the number of ones in a vector

2010-02-27 Thread Gavin Simpson
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

Re: [R] counting the number of ones in a vector

2010-02-26 Thread David Reinke
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

Re: [R] counting the number of ones in a vector

2010-02-26 Thread Nutter, Benjamin
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

Re: [R] counting the number of ones in a vector

2010-02-26 Thread Jorge Ivan Velez
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

Re: [R] counting the number of ones in a vector

2010-02-26 Thread Jorge Ivan Velez
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

Re: [R] counting the number of ones in a vector

2010-02-26 Thread Tobias Verbeke
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

Re: [R] counting the number of ones in a vector

2010-02-26 Thread Henrique Dallazuanna
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]] >

[R] counting the number of ones in a vector

2010-02-26 Thread Randall Wrong
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

Re: [R] counting the number of ones in a vector

2010-02-26 Thread Nutter, Benjamin
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

[R] counting the number of ones in a vector

2010-02-26 Thread Randall Wrong
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