From ellis at stat.harvard.edu  Wed Jul  6 08:03:54 2005
From: ellis at stat.harvard.edu (Byron Ellis)
Date: Tue, 5 Jul 2005 23:03:54 -0700
Subject: [Rd] Compiling R scripts
In-Reply-To: <BDF571786CAD224F966FEB86BEDED52F1433DF91@elon12p32001.csfp.co.uk>
References: <BDF571786CAD224F966FEB86BEDED52F1433DF91@elon12p32001.csfp.co.uk>
Message-ID: <2DCDDA61-41EB-4E8B-8982-5ECEA1FA41C9@stat.harvard.edu>


On Jul 4, 2005, at 6:31 AM, Uzuner, Tolga wrote:

> Dear R Developers,
>
> A recommendation for future development.
>
> It would help if R scripts could be compiled into an executable, or  
> a library. Speed is the main issue (I run a large scale monte carlo  
> in R which is very slow). However, it would also make it easier to  
> link R into other applications, easier at least than the COM  
> infrastructure under Windows.
>

1. Easier said than done. Much much easier said than done.
2. Move the bottleneck bits to C. Alternatively, I've found that for  
MCMC at least, employing R's lexical scoping features and using  
sapply to do the iteration can vastly improve performance (as well as  
improving your code's readability). If you're doing pure monte carlo  
the lexical scoping may not be of much help, but using something like  
sapply often helps. R is not C/C++/Java/Fortran and should not be  
programmed as such.
3. Look at the RDCOM stuff at www.omegahat.org.


> Finally, it would make it much easier to farm R apps: rather than  
> distributing all of R and necessary libraries onto each client, and  
> making sure each client is always up to date as libraries for a  
> specific script change, it might be easier just to distribute a  
> simple executable across all nodes.

Put all of that into an R package and then put the package into a  
local library location (i.e. one in your home directory). Unless  
something is odd, your home directory should be distributed to all  
nodes. Unless you're running a Windows cluster, at which point I have  
to ask... why?

>
> Regards,
> Tolga
>
>
> ====================================================================== 
> ========
> Please access the attached hyperlink for an important electronic  
> communications disclaimer:
>
> http://www.csfb.com/legal_terms/disclaimer_external_email.shtml
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

---
Byron Ellis (ellis at stat.harvard.edu)
"Oook" -- The Librarian



[Rd] Compiling R scripts
Byron Ellis