Rprof(NULL)
summaryRprof()
Error in summaryRprof() : no events were recorded
Zhen
From: Prof Brian Ripley [EMAIL PROTECTED]
To: Zhen Pang [EMAIL PROTECTED]
CC: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [R] sapply and loop
Date: Tue, 19 Oct 2004 07:29:54 +0100 (BST)
On Tue
On Tue, 19 Oct 2004, Zhen Pang wrote:
I tried to use Rprof(). As an example, I consider the following code (from
Venables Ripley, 1999).
I believe you parroted that from `Writing R Extensions', but failed to
give proper credit!
library(MASS); library(boot); library(nls)
()
storm.boot - boot(rs, storm.bf, R = 4999) # pretty slow
Rprof(NULL)
summaryRprof()
Error in summaryRprof() : no events were recorded
Zhen
From: Prof Brian Ripley [EMAIL PROTECTED]
To: Zhen Pang [EMAIL PROTECTED]
CC: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [R] sapply and loop
Date: Tue
Rprof(NULL)
summaryRprof()
Error in summaryRprof() : no events were recorded
Zhen
From: Prof Brian Ripley [EMAIL PROTECTED]
To: Zhen Pang [EMAIL PROTECTED]
CC: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [R] sapply and loop
Date: Tue, 19 Oct 2004 07:29:54 +0100 (BST)
On Tue, 19 Oct 2004
PROTECTED]
Subject: Question on Rprof(); was: Re: [R] sapply and loop
Date: Tue, 19 Oct 2004 09:54:39 +0200
Zhen Pang wrote:
I am sorry for neglecting the acknowledgement for `Writing R Extensions',
since I think I am just citing the code from the orignal R-help. I fail to
get the results when I use my
On Sat, 16 Oct 2004, Zhen Pang wrote:
Dear all,
I am doing 200 times simulation. For each time, I generate a matrix and
define some function on this matrix to get a 6 dimension vector as my
results.
As the loop should be slow, I generate 200 matrice first, and save them into
a list named ma,
PROTECTED]
Subject: Re: [R] sapply and loop
Date: Mon, 18 Oct 2004 09:14:49 -0700 (PDT)
On Sat, 16 Oct 2004, Zhen Pang wrote:
Dear all,
I am doing 200 times simulation. For each time, I generate a matrix and
define some function on this matrix to get a 6 dimension vector as my
results.
As the loop should
Zhen,
how to count the exact time ?
system.time(base)
Returns CPU (and other) times that expr used.
If you only need seconds, you can also do
date();zz-sapply(ma, myfunction);date()
I do not know about how to reduce the time.
For very comlex iterations, I use for( ) myself, which maybe
You can use system.time() to time your procedure. There's no guarantee that
sapply() will be faster than a for() loop, especially if you preallocate the
matrices.
-roger
Zhen Pang wrote:
Dear all,
I am doing 200 times simulation. For each time, I generate a matrix and
define some function on
Without seeing what myfunction is, it's almost impossible to tell.
In addition to system.time(), you might want to profile your code. e.g.,
Rprof()
zz - sapply(ma, myfunction)
Rprof(NULL)
summaryRprof()
HTH,
Andy
From: Zhen Pang
Dear all,
I am doing 200 times simulation. For each time,
PROTECTED]
To: 'Zhen Pang' [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: [R] sapply and loop
Date: Sat, 16 Oct 2004 08:23:54 -0400
Without seeing what myfunction is, it's almost impossible to tell.
In addition to system.time(), you might want to profile your code. e.g.,
Rprof()
zz - sapply(ma
Dear all,
I am doing 200 times simulation. For each time, I generate a matrix and
define some function on this matrix to get a 6 dimension vector as my
results.
As the loop should be slow, I generate 200 matrice first, and save them into
a list named ma,
then I define zz-sapply(ma, myfunction)
12 matches
Mail list logo