[R] Average Login based on date
David Winsemius
dwinsemius at comcast.net
Sat May 1 21:33:57 CEST 2010
On May 1, 2010, at 2:07 PM, Mohan L wrote:
> Hi All,
>
> I have the data like this :
>
>> sample <- read.csv(file="sample.csv",sep=",",header=TRUE)
>> sample
>
> stdate Domain sex age Login
> 1 01/11/09 xxx FeMale 25 2
> 2 01/11/09 xxx FeMale 35 4
> 3 01/11/09 xxx Male 18 30
> 4 01/11/09 xxx Male 31 3
> 5 02/11/09 xxx Male 32 11
> 6 02/11/09 xxx Male 31 1
> 7 02/11/09 xxx FeMale 29 1
> 8 02/11/09 xxx FeMale 23 5
> 9 03/11/09 xxx FeMale 25 9
> 10 03/11/09 xxx FeMale 35 6
> 11 03/11/09 xxx Male 18 3
> 12 03/11/09 xxx Male 31 0
> 13 04/11/09 xxx Male 32 25
> 14 04/11/09 xxx Male 31 1
> 15 04/11/09 xxx FeMale 29 0
> 16 01/11/09 yyy FeMale 25 2
> 17 01/11/09 yyy FeMale 35 4
> 18 01/11/09 yyy Male 18 30
> 19 01/11/09 yyy Male 31 3
> 20 02/11/09 yyy Male 32 11
> 21 02/11/09 yyy Male 31 1
> 22 02/11/09 yyy FeMale 29 1
> 23 02/11/09 yyy FeMale 23 5
> 24 03/11/09 yyy FeMale 25 9
> 25 03/11/09 yyy FeMale 35 6
> 26 03/11/09 yyy Male 18 3
> 27 03/11/09 yyy Male 31 0
> 28 04/11/09 yyy Male 32 25
> 29 04/11/09 yyy Male 31 1
> 30 04/11/09 yyy FeMale 29 0
>
> I need to fine the average login on 01/11/09 and 02/11/09 etc...
> like below
avglog <- with(sample, tapply(Login, stdate, mean) )
>
> stdate AverageLogin
> 01/11/09 9.75
> 02/11/09 .....
> 03/11/09 .......
>
> How do I find the average Login based on date?
>
> Thanks for your time.
> Mohan L
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list