time it is absolute essential to use the
right data structure for the job.
Hope this is of assistance,
Jeremiah Rounds
> Date: Mon, 8 Jun 2009 15:45:40 +0000
> From: amitrh...@yahoo.co.uk
> To: r-help@r-project.org
> Subject: [R] help to speed up loops in r
>
>
>
Bert Gunter
Genentech nonclinical Statistics
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Jorge Ivan Velez
Sent: Monday, June 08, 2009 9:03 AM
To: Amit Patel
Cc: r-help@r-project.org
Subject: Re: [R] help to speed up loop
Dear Amit,
The following should get you started:
# Some data
set.seed(123)
X <- matrix(rnorm(20*10), ncol=10)
X
# Group of replicates
g <- rep(1:(ncol(X)/2), each=2)
g
# Mean of replicate variables
t(apply(X, 1, tapply, g, mean, na.rm = TRUE))
I created a grouping variable (g) and then calculat
Hi
i am using a script which involves the following loop. It attempts to reduce a
data frame(zz) of 95000 * 41 down to a data frame (averagedreplicates) of 95000
* 21 by averaging the replicate values as you can see in the script below. This
script however is very slow (2days). Any suggestions
4 matches
Mail list logo