Re: [R] Problem using the source-function within R-functions

2009-10-21 Thread Duncan Murdoch
On 10/21/2009 3:53 AM, Johan Lassen wrote: Hi Giovanni, Thanks for your reply. I can make the function work after parsing the code directly into R. The problem arise after compiling the function into a package and then calling the function, because the files inside "source()" seems to be missing

Re: [R] Problem using the source-function within R-functions

2009-10-21 Thread Johan Lassen
Hi Giovanni, Thanks for your reply. I can make the function work after parsing the code directly into R. The problem arise after compiling the function into a package and then calling the function, because the files inside "source()" seems to be missing. I tried to include the sourced files in th

Re: [R] Problem using the source-function within R-functions

2009-10-20 Thread Giovanni Petris
The problem probably lies in the source-ing part: look at getwd() setwd() HTH, Giovanni > Date: Tue, 20 Oct 2009 13:00:02 +0200 > From: Johan Lassen > Sender: r-help-boun...@r-project.org > Precedence: list > DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; > DomainK

Re: [R] Problem using the source-function within R-functions

2009-10-20 Thread Ista Zahn
Hi Johan, Although it's not clear to my why you're putting this in a function in the first place... The way you've written your function it will only work if your working directory is the same as the directory where file1.r and file2.r are stored, and I suspect this is the problem. You can 1) set

[R] Problem using the source-function within R-functions

2009-10-20 Thread Johan Lassen
Dear R community, You may have the solution to how to construct a function using the function "source()" to build the function; i.e. myfunction <- function(...){ source('file1.r') source('file2.r') } After compiling and installing the "myfunction" in R, then calling the "myfunction" gives an err