Dear R-users, I've spent most of the day reading R documentation at length but couldn't find something perhaps obvious. I have a dataset made of 3 morphometric variables for a series of watershed [log(slope); log(drainage_area); distance_to_outlet] My aim is to predict the value of log(slope) for pairs of [drainage_area; distance_to_outlet] (sounds like a plain linear model fitting, right, nothing too fancy there). In the literature, the standard procedure is to reduce the number of observations by computing the mean value of slope insides bins of log(drainage_area) and distance_to_outlet respectively. Usually, we start with dispersed point clouds and try desperately to reduce the scatter, hence this binning and averaging procedure. How would you go about this? That is: 1. how does one create bins in two (or n?) dimensions? 2. how does one how does one compute the mean(or median) value of log(slope) inside each bin? Any clue is welcome Thomas *** Le contenu de cet e-mail et de ses pi??ces jointes est destin?? ?? l'usage exclusif du (des) destinataire(s) express??ment d??sign??(s) comme tel(s). En cas de r??ception de cet e-mail par erreur, le signaler ?? son exp??diteur et ne pas en divulguer le contenu. L'absence de virus a ??t?? v??rifi?? ?? l'??mission du message. Il convient n??anmoins de v??rifier l'absence de corruption ?? sa r??ception. The contents of this email and any attachments are confidential. They are intended for the named recipient(s) only. If you have received this email in error please notify the system manager or the sender immediately and do not disclose the contents to anyone or make copies. eSafe scanned this email for viruses, vandals and malicious content. ***