Heidemeier Dr, Joachim <joachim.heidemeier <at> uba.de> writes:
> ... > 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? df = data.frame(x=rnorm(10,10),y=rnorm(10,20)) df$xgrouped = (df$x+df$y) %/%2 ______________________________________________ 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.