Well, R has a by() function that does what you want, and its help page contains an example of doing regression by group.
(There are other ways.) On Fri, 3 Aug 2007, Paul Young wrote: > So I am trying to perform a robust regression (fastmcd in the robust > package) on a dataset and I want to perform individual regressions based fastmcd does not do regression ... or I would have adapted the ?by example to show you. > on the groups within the data. We have over 300 sites and we want to > perform a regression based on the day of week and the hour for every > site. I was wondering if anyone knows of a "'by' command similar to the > one used in SAS that automatically groups the data for the regressions. > If not, does anyone have any tips on how to split the data into smaller > sets and then perform the regression on each set. I am new to R, so I > don't know all of the common work arounds and such. At the moment the > only method I can think of is to split the data using condition > statements and manually running the regression on each set. Thanks or > your help > > -Paul -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ R-help@stat.math.ethz.ch 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.