[R] Matrix multiplication using apply() or lappy() ?

Jeffrey J. Hallman jhallman at frb.gov
Fri Sep 8 21:46:14 CEST 2006


Tim Hesterberg <timh at insightful.com> writes:

> toby_marks at americancentury.com asked:
> >I am trying to divide the columns of a matrix by the first row in the 
> >matrix.
> 
> Dividing columns of a matrix by a vector is a pretty fundamental
> operation, and the query resulted in a large number of suggestions:
> 
> 
> It is unsatisfactory when such a fundamental operation is
> done in so many different ways.  
> * It makes it hard to read other people's code.  
> * Some of these are very inefficient.

But since you have no way to force people to use your new 'standard'
operators, people can and will still use any of those myriad ways you decry to
do the same thing.  It's part of the price you pay for working with a flexible
system. 

Besides, nothing will ever make it easy to read other people's code. :-)

Jeff



More information about the R-help mailing list