Re: [R] counting values on one colum only

From: jim holtman <jholtman_at_gmail.com>
Date: Sat, 22 Mar 2008 20:03:10 -0500

There are 7 rows since this is probably a data frame and each column in a dataframe (or a matrix in this case) all have the same number of rows. I think what you want is to 'sum' the number of times a condition is met; this might come closer to what you were expecting:

sum(weekly$a != 0)

On Sat, Mar 22, 2008 at 6:16 PM, Felipe Carrillo <mazatlanmexico_at_yahoo.com> wrote:
> Hi all:
> Can someone help me count the
> number of rows with values in
> colum "a" only. assume the name
> of my dataframe is "weekly"
> I was trying
> i<- nrows(weekly$a)
> i
> but returns 7 when it should
> be 4. Thanks
> a b c d
> 27.000
> 27.000
> 1.569 0.013 160.000 27.000
> 1.632 0.013 146.000 27.000
> 1.830 0.015 70.000 27.000
> 2.475 0.019 156.000 27.000
> 27.000
>
> Felipe D. Carrillo
> Fishery Biologist
> Department of the Interior
> US Fish & Wildlife Service
> California, USA
>
>
>
> ____________________________________________________________________________________
> Be a better friend, newshound, and
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 23 Mar 2008 - 01:08:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 23 Mar 2008 - 03:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive