[R] counting values on one colum only
jim holtman
jholtman at gmail.com
Sun Mar 23 02:03:10 CET 2008
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?
More information about the R-help
mailing list