Hi,
Being new to R I'm asking for some advice on how to optimize the
performance of the following piece of code:
alpha_c - function(lambda=600e-9,alpha_s=1e-14,N=400,spacing=1e-7){
k-2*pi/lambda
ri-c(0,0) # particle at the origin
x-c(-N:N)
positions - function(N) {
reps - 2*N+1
First question is why are you defining the functions within the main
function each time? Why don't you define them once outside?
On 7/23/07, baptiste Auguié [EMAIL PROTECTED] wrote:
Hi,
Being new to R I'm asking for some advice on how to optimize the
performance of the following piece of
Thanks for your reply,
On 23 Jul 2007, at 15:19, jim holtman wrote:
First question is why are you defining the functions within the main
function each time? Why don't you define them once outside?
Fair enough!
As said, I'm new to R and don't know whether it is best to define
functions
The quote what is the problem you are trying to solve is just part
of my signature. I used to review projects for performance and
architecture and that was the first question I always asked them.
To pass the argument, if you notice the definition of apply:
apply(X, MARGIN, FUN, ...)
the ...