[R] Newbie question about data preparation

Heidemeier Dr, Joachim joachim.heidemeier at uba.de
Wed Nov 14 09:18:29 CET 2007


I'm new to the R language and still struggling with compactness of R. I
haven't got the right compass into the Documentation, too. So, please
apologize the possibly stupidiy of my question.
I have the following problem:
I have two data sets combined in a data.frame
 x	y
1.3	2.2
2.5	3.4
3.1	3.7
8.2	9.5 
7.5	8.3
For the analyses of the data I want to group one column (like the
classes in a histogram).
So I'd like to add one column with the center of each group with width=2
for an x value in the interval of the class.
So the output should look like 
  x	y	x-grouped
1.3	2.2	1
2.5	3.4	3
3.1	3.7	3	
8.2	9.5 	9
7.5	8.3	7
What would be the R'ish idiom to do this operation?

TIA
joachim
-- 
Dr. Joachim Heidemeier
c/o Umweltbundesamt FG II 2.2
Tel.: +49340 2103-2780 
eMail: joachim.heidemeier at uba.de
 



More information about the R-help mailing list