[R] counting values on one colum only

Felipe Carrillo mazatlanmexico at yahoo.com
Sun Mar 23 18:10:42 CET 2008


I was able to figure it out. I used  
daysSamp<- na.omit(weekly)
 daysSamp<- nrow(daysSamp)
 daysSamp
>4
I ommited the NA's and then counted the number of
rows. Thanks for your time Mark

 
> I'm not an R expert but if you show me the
> str(weekly) output, i think I can answer your
> question.
> 
> 
> >Mark:
> >I basically need to count the number of rows that
> have
> >values only. I tried your example and it crashed.I
> >have been reading and looking for a function that
> does
> >that but no luck...
> >
> >--- markleeds at verizon.net wrote:
> >
> >> >From: Felipe Carrillo <mazatlanmexico at yahoo.com>
> >> >Date: 2008/03/22 Sat PM 06:16:59 CDT
> >> >To: r-help at stat.math.ethz.ch
> >> >Subject: [R] counting values on one colum only
> >> 
> >> i'm not sure i understand what you want
> >> because, by definition,
> >> a dataframe can't have a different
> >> number of rows in each column ?
> >> maybe  
> >> 
> >> i<-nrow(!is.na(weekly$a)) 
> >> 
> >> if the blanks are actually NAs ?
> >> 
> >> 
> >> >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.
> >> 
> >> 
> >
> >
> > Felipe D. Carrillo
> >  Fishery Biologist
> >  Department of the Interior
> >  US Fish & Wildlife Service
> >  California, USA
> >
> >
> >
> >     
>
____________________________________________________________________________________
> >Looking for last minute shopping deals?  

>

> 
> 


 Felipe D. Carrillo
  Fishery Biologist
  Department of the Interior
  US Fish & Wildlife Service
  California, USA



More information about the R-help mailing list