Hi! Is it a data frame, please?
Have you tried the "table" function or "cut" function? Sincerely, Erin ________________________________________ From: r-sig-geo-boun...@r-project.org [r-sig-geo-boun...@r-project.org] on behalf of Elaine Kuo [elaine.kuo...@gmail.com] Sent: Saturday, December 15, 2012 10:15 PM To: r-help@r-project.org; r-sig-geo Subject: [R-sig-Geo] averaging X of specific Y (latitude) Hello I have a table describing butterfly range traits. It is composed of three columns as below Species name range size (X) latitude of range midpoint (Y) There are 11 kinds of butterflies. Each has its range size, and the latitude of each range midpoint ranges from 9 to 19. I would like to have the average range size of every degree of latitude. For example, the average range size of latitude degree 10 (10.0-10.99: Butterfly A2, B1, B2) Please kindly help with R code to calculate the average values. Thank you. Elaine The details are as followed. Butterfly A1 130.5 9.45 Butterfly A2 450.68 10.2 Butterfly A3 1102.38 9.3 Butterfly A4 893.34 16.4 Butterfly B1 820.2 10.54 Butterfly B2 872.2 10.87 Butterfly B3 488.2 16.79 Butterfly B4 620.11 18.3 Butterfly B5 982.78 12.98 Butterfly C1 720.32 12.67 Butterfly C2 912.2 18.07 [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list r-sig-...@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo ______________________________________________ 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.