Re: [R] increase the usage of CPU and Memory

2012-06-27 Thread Richard R. Liu
Hello Xi, Have you tried replacing the for loop by an apply construct, e.g., lapply or sapply? In my experience these functions are more efficient than for. At any rate, if you succeed with, say, lapply, there are some R packages that support parallel processing versions. I believe the packa

Re: [R] increase the usage of CPU and Memory

2012-06-27 Thread Arnaud Mosnier
Hi Xi, Maybe you should try to "parallelize" your calculations. See package "parallel". http://stat.ethz.ch/R-manual/R-devel/library/parallel/doc/parallel.pdf Arnaud On Mon, Jun 25, 2012 at 8:07 PM, Xi wrote: > Dear All, > > I have been searching online for help increasing my R code more effici

Re: [R] increase the usage of CPU and Memory

2012-06-26 Thread Oliver Ruebenacker
Hello Christopher, If a process has data to write to hard disk, the data is usually written to a buffer in memory, and from there it is written to the hard disk independently of the CPU. Since writing to memory is much faster than writing to hard disk, this allows the process to run faster.

Re: [R] increase the usage of CPU and Memory

2012-06-26 Thread Christofer Bogaso
On 26-06-2012 16:33, Oliver Ruebenacker wrote: Hello Xi, If a program has input or output to disk or network, this may cause it to wait and not use the available CPU. Output is usually buffered, but may cause delay if the buffer gets full (I'm not sure though whether this is an issu

Re: [R] increase the usage of CPU and Memory

2012-06-26 Thread Oliver Ruebenacker
Hello Xi, If a program has input or output to disk or network, this may cause it to wait and not use the available CPU. Output is usually buffered, but may cause delay if the buffer gets full (I'm not sure though whether this is an issue with plenty of memory available) Take care

Re: [R] increase the usage of CPU and Memory

2012-06-26 Thread Prof Brian Ripley
See the vignette for package 'parallel' to make use of your 4 cores. On 26/06/2012 01:07, Xi wrote: Dear All, I have been searching online for help increasing my R code more efficiently for almost a whole day, however, there is no solution to my case. So if anyone could give any clue to solve m

[R] increase the usage of CPU and Memory

2012-06-26 Thread Xi
Dear All, I have been searching online for help increasing my R code more efficiently for almost a whole day, however, there is no solution to my case. So if anyone could give any clue to solve my problem, I would be very appreciate for you help. Thanks in advance. Here is my issue: My desktop i