[R] Calculate mean between to classes for each ID

Patrick Connolly p_connolly at slingshot.co.nz
Tue Feb 14 20:07:23 CET 2012


On Tue, 14-Feb-2012 at 04:30AM -0800, Sana wrote:

|> I have a data set that looks like this:
|> ID	STRATA	G_F_Bl	Dkl	N	g_pr_dkl	N_ha	G_ha
|> 20,103	2	1	5	5	0,002	250	0,5
|> 20,103	2	1	7	3	0,0038	150	0,57
|> 20,103	2	1	9	6	0,0064	300	1,92
|> 20,103	2	1	11	1	0,0095	50	0,475
|> 20,103	2	1	13	1	0,0133	50	0,665
|> 20,103	2	1	15	1	0,0177	50	0,885
|> 20,103	2	1	17	3	0,0227	150	3,405
|> 20,103	2	1	21	2	0,0346	100	3,46
|> 20,103	2	1	23	2	0,0415	100	4,15
|> 20,103	2	1	25	2	0,0491	100	4,91
|> 20,103	2	1	27	1	0,0573	50	2,865
|> 20,103	2	1	29	1	0,0661	50	3,305
|> 20,103	2	1	37	1	0,1075	50	5,375
|> 20,7	2	1	5	10	0,002	500	1
|> 20,7	2	1	7	7	0,0038	350	1,33
|> 20,7	2	3	7	1	0,0038	50	0,19
|> 20,7	2	1	9	7	0,0064	350	2,24
|> 20,7	2	1	11	1	0,0095	50	0,475
|> 20,7	2	1	13	1	0,0133	50	0,665
|> 20,7	2	1	15	3	0,0177	150	2,655
|> 20,7	2	1	19	2	0,0284	100	2,84
|> 20,7	2	1	21	3	0,0346	150	5,19
|> 20,7	2	1	23	2	0,0415	100	4,15
|> 
|> I'd like to calculate the mean  for g_pr_dkl   between Dkl for each ID.
|> Can anybode please help me?

?aggregate


|> 
|> Thanks,
|> Sana
|> 
|> --
|> View this message in context: http://r.789695.n4.nabble.com/Calculate-mean-between-to-classes-for-each-ID-tp4386842p4386842.html
|> Sent from the R help mailing list archive at Nabble.com.
|> 	[[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.

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___    Patrick Connolly   
 {~._.~}                   Great minds discuss ideas    
 _( Y )_  	         Average minds discuss events 
(:_~*~_:)                  Small minds discuss people  
 (_)-(_)  	                      ..... Eleanor Roosevelt
	  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.



More information about the R-help mailing list