Re: [R] creating conditional means

2007-12-06 Thread Gabor Grothendieck
The error message says you have duplicate row names and that is not allowed. Make sure you have the same number of elements on each line of data as in the header. If you have one more on each line than on the header then the first data item on each line will be regarded as the row name. See ?cou

Re: [R] creating conditional means

2007-12-06 Thread Sherri Heck
hi gabor, i was able to get your suggestion to work. i have been going through the R help tools to figure out what each step actually does because i have something similar but hours 2,5,8,11,14,17 and 20 are missing. i haven't had any luck. each "mean value" that is calculated is the same.

Re: [R] creating conditional means

2007-12-02 Thread Moshe Olshansky
Following Gabor's suggestion, if x is your data.frame you can do y <- x[x$month %in% c(3,4,5),] aggregate(y[,4:6],list(y$hour),mean) --- Sherri Heck <[EMAIL PROTECTED]> wrote: > Hi Gabor, > > Thank you for your help. I think I need to clarify > a bit more. I am > trying to say > > average

Re: [R] creating conditional means

2007-12-01 Thread Gabor Grothendieck
Just adjust the formula for Qtr appropriately if your quarters are not Jan/Feb/Mar, Apr/May/Jun, Jul/Aug/Sep, Oct/Nov/Dec as I assumed. On Dec 1, 2007 5:21 PM, Sherri Heck <[EMAIL PROTECTED]> wrote: > Hi Gabor, > > Thank you for your help. I think I need to clarify a bit more. I am > trying to s

Re: [R] creating conditional means

2007-12-01 Thread Sherri Heck
Hi Gabor, Thank you for your help. I think I need to clarify a bit more. I am trying to say average all 2pms for months march + april + may (for example). I hope this is clearer. here's a larger subset of my data set: year, month, hour, co2(ppm), num1,num2 2006 1 0 384.2055 14 14 2006 1

Re: [R] creating conditional means

2007-12-01 Thread Gabor Grothendieck
Try aggregate: Lines <- "Year Month Hour co2 num1 num2 2006 110 383.3709 28 28 2006 111 383.3709 28 28 2006 112 383.3709 28 28 2006 113 383.3709 28 28 2006 114 383.3709 28 28 2006 115 383.3709 28 28 2006 116 383.3709 28

[R] creating conditional means

2007-12-01 Thread Sherri Heck
Hi all- I have a dataset (year, month, hour, co2(ppm), num1,num2) [49,] 2006 110 383.3709 28 28 [50,] 2006 111 383.3709 28 28 [51,] 2006 112 383.3709 28 28 [52,] 2006 113 383.3709 28 28 [53,] 2006 114 383.3709 28 28 [54,] 2006 115 383.3709