Hi Duncan,

Thanks for replying. I may need to clarify.

What I want is something that can let one R file in a package aware of
another R file in the same package. It does happen a lot in real life, for
example for organizing the functions into separate files, or just because
you need to include a third party provided R file containing functions.

Something alike in C you can include a file and within the same directory
by double quote and call its functions. Just wonder how R is handling this
type of include so that the included function will work even after the
package is deployed.

load the package itself will cause cyclic load error. direct source the R
file will cause complain of file not found after installation.

Thanks


On Thu, Jan 23, 2014 at 6:08 PM, Duncan Murdoch <murdoch.dun...@gmail.com>wrote:

> On 14-01-23 7:54 PM, Charlie Xia wrote:
>
>> Hi all,
>>
>> I have a very quick question yet found no answers with google.
>> Say you when you are writing a package and have R/A.r and R/B.r, if you
>> want to load B.r in A.r, is there an obvious way to do so?
>>
>
> That question doesn't make sense.  You should think of package code as all
> being executed when the package is installed.  (There are some exceptions
> to this, e.g. functions that are called when the package is loaded.)
>
> The user may choose to call some of your functions, and they may call
> others, but it's not a good idea to think of the source for them as scripts.
>
> Duncan Murdoch
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to