Hi,
thank you very much Sundar, Patrick, Tony, Mahub and Gabor for your helpful
answers! All your examples work great. They are all more straightforeward
than my example and much faster than the for-loop.
These are the average elapsed times (in seconds) returned by system.time()[3]
(applied
Arne Henningsen ahenningsen at email.uni-kiel.de writes:
:
: Hi,
:
: thank you very much Sundar, Patrick, Tony, Mahub and Gabor for your helpful
: answers! All your examples work great. They are all more straightforeward
: than my example and much faster than the for-loop.
: These are the
On Tuesday 02 November 2004 15:29, Gabor Grothendieck wrote:
Arne Henningsen ahenningsen at email.uni-kiel.de writes:
: Hi,
:
: thank you very much Sundar, Patrick, Tony, Mahub and Gabor for your
: helpful answers! All your examples work great. They are all more
: straightforeward than my
Arne Henningsen ahenningsen at email.uni-kiel.de writes:
:
: On Tuesday 02 November 2004 15:29, Gabor Grothendieck wrote:
: Arne Henningsen ahenningsen at email.uni-kiel.de writes:
: : Hi,
: :
: : thank you very much Sundar, Patrick, Tony, Mahub and Gabor for your
: : helpful answers! All
Hi,
I have a dataframe (say myData) and want to get a list (say myList) that
contains a matrix for each row of the dataframe myData. These matrices are
calculated based on the corresponding row of myData. Using a for()-loop to do
this is very slow. Thus, I tried to use apply(). However, afaik
for()-loops aren't so bad. Look inside the code of apply() and see what it
uses! The important thing is that you use vectorized functions to
manipulate vectors. It's often fine to use for-loops to manipulate the
rows or columns of a matrix, but once you've extracted a row or a column,
then
How about this...
x = matrix(1:27, ncol=9, byrow=T)
nr= nrow(x)
lapply(1:nr, function(i) matrix(x[i,], nrow=3, byrow=T))
Mahbub.
On Mon, 1 Nov 2004 19:37:08 +0100, Arne Henningsen
[EMAIL PROTECTED] wrote:
Hi,
I have a dataframe (say myData) and want to get a list (say myList) that
Arne Henningsen ahenningsen at email.uni-kiel.de writes:
:
: Hi,
:
: I have a dataframe (say myData) and want to get a list (say myList) that
: contains a matrix for each row of the dataframe myData. These matrices are
: calculated based on the corresponding row of myData. Using a for()-loop