Re: [Rd] Locating code that is outside of functions in R scripts

2009-12-28 Thread Wolfgang Huber
Dear Gheine, you could also start creating your own package with these functions, and manage the code using R's well thought-out package management functionalities, with namespaces etc. At some point, this might be less effort than (re-)inventing tools as below. Best wishes

Re: [Rd] Locating code that is outside of functions in R scripts

2009-12-23 Thread Gabor Grothendieck
This sources the indicated file into the local environment (i.e. the environment within src) and then only copies out the objects that are functions into the workspace so that you are only left with them. src <- function(file) { source(file, local = TRUE) for(nm in ls(all = TRUE)) if (is.fun

Re: [Rd] Locating code that is outside of functions in R scripts

2009-12-23 Thread Duncan Murdoch
On 23/12/2009 7:04 PM, ghe...@mathnmaps.com wrote: Working with a number of scripts (text files with R commands) that I "source" into R sessions from time to time. The source() command is most convenient (at least for me) if it only loads function definitions, and doesn't otherwise change th