[R] Moving window regressions - how can I improve this code?

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun May 16 08:31:20 CEST 2004


You forgot drop=FALSE, one of the commonest S programmers' oversights.
The lm.fit call should be

                            fit = lm.fit(x[ind, , drop = FALSE], y[ind])

Please don't mix assignment operators in posted code, BTW.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
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




More information about the R-help mailing list