[R] Get count by day for particular coulmn

R_Antony antony.akkara at ge.com
Fri Jun 7 13:38:36 CEST 2013


here i have a dataframe 

for eg:-
DATETIME	COL_A	COL_B	COL_C	COL_D
1/1/2007 0:01	0	3	0	0
1/1/2007 0:02	0	0	3	0
1/1/2007 0:03	0	3	0	0
.......................       .....             ...             ...             
....				
1/2/2007	0	0	3	0
1/2/2007 0:01	0	3	4	0
1/2/2007 0:02	0	3	0	0
.......................       .....             ...             ...             
....
1/3/2007	0	0	0	0
1/3/2007 0:01	0	0	4	0
1/3/2007 0:02	0	3	0	0
.......................       .....             ...             ...             
....

My requirement what is, i have to get the count for each "day " where COL_B
= 3

For eg:- here i need to get like
DATETIME           COUNT(COL_B=3)
------------            ------------
1/1/2007               2
1/2/2007               3
1/3/2007               1

=============================
=============================

and this way i tried to get,
MyDF[MyDF["DATETIME"]=="1/2/2007"]  ---> here this only select the row where
DATETIME - column coming as
"1/2/2007" - date and not selecting other rows where same date is coming
(eg:- 1/1/2007 0:01). And here i need to get the complete records for that
particular day, when i give date without giving timestamp. 

- Could anyone give a help ASAP ?

- Thanks
Antony.





--
View this message in context: http://r.789695.n4.nabble.com/Get-count-by-day-for-particular-coulmn-tp4668915.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list