Re: [R] Improving performance by rewriting for loops into apply functions

2016-07-23 Thread Ranjan Maitra
Hi, The apply here does exactly what you would expect. (Your problem seems to be with the function that you have written. For some reason, you want to change the values of path2 but are passing it as a variable o a function. The global value of path2 will not change.) For that, you have to also

Re: [R] Improving performance by rewriting for loops into apply functions

2016-07-22 Thread Jeff Newmiller
If you complain to the doctor that it hurts when you ram your head into the wall, (s)he is going to tell you to not so that. What do you expect us to say? You seem full of misinformation. The apply family functions do not necessarily speed anything up... they are just more compact than for loop

[R] Improving performance by rewriting for loops into apply functions

2016-07-22 Thread Aleš Grm
Hello, I have a slight performance issue that I'd like to solve by rewriting a short bit of code that uses for loops so that it would use apply in order to get some performance gains. My problem is that I can't modify the variables that are passed to apply function during apply functions execution