Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.A41.4.44.0304030637440.66102-100000@homer22.u.washington.edu>
Date: 2003-04-03T14:38:40Z
From: Thomas Lumley
Subject: Efficiency: whole vector and for loop methods
In-Reply-To: <F154QfhuHeoGLaREOQP0000747f@hotmail.com>

On Wed, 2 Apr 2003, graham lawrence wrote:

>
> Dear R-help,
>
> As a generalization, is it more efficient to use a single method to
> selectively transform items in a matrix?  Preferably whole-vector, yes; but
> if one of the column vectors compels the use of a "for loop", is it then
> faster to do all of the transformations for the matrix via that "for loop",
> rather than use a mixture of methods on a column-wise basis?
>

Hard to say.

My guess is that a mixture of methods would be faster, but the only
reliable answer to 'is it faster' is to try it and see.

	-thomas