Hello,

The only explanation I'm seeing is you are computing the SunScore averages using different datasets. With the dataset oyu've dput-ed I get your hand results.

aggregate(SunScore ~ h, data=dat, mean)
  h SunScore
1 0 131.0167
2 1 107.7436

# Another way of doing the same
sapply(split(dat$SunScore, h), mean, na.rm=TRUE)
       0        1
131.0167 107.7436

Also, please quote the message you're answering to, it's better to have context.

Rui Barradas

Em 28-06-2012 14:16, APOCooter escreveu:
That is very helpful, and exactly what I was looking for!

However, I seem to have some problems.  When I ran the following line:

aggregate(SunScore ~ h, data=dat, mean)

I got the following output:

     h  SunScore
1   0 136.01389
2   1 135.27632
3   2 127.03704
4   3 127.17105
5   4 129.94545
6   5 113.70909
7   6 111.49020
8   7 109.51020
9   8  98.03922
10  9  88.40000
11 10  72.57407
12 11  63.41333
13 12  68.36170
14 13  68.28571
15 14  77.47761
16 15  93.18056
17 16 108.78161
18 17 112.39759
19 18 126.17241
20 19 126.98901
21 20 134.03896
22 21 131.48611
23 22 135.06024
24 23 136.02247

But when I do the averages by hand, I get different numbers.  When I
calculated the average of the scores from 0:00 to 0:59, I got a score of
131.01667.  However, R says the average for the same time period is
136.01389.  Why are these numbers so different? And how can I fix it?

--
View this message in context: 
http://r.789695.n4.nabble.com/Questions-about-doing-analysis-based-on-time-tp4634230p4634745.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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.


______________________________________________
R-help@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.

Reply via email to