Here is the way that I do it instead of creating a package of my functions.
I 'source' the file into an environment and then attach the environment
to
keep the global from being clustered:
# read my functions into a environment
.my.env <- new.env()
sys.source('c:/perf/bin/perfmon.r', envir=.my.env)
attach(.my.env)
On Thu, Jun 18, 2009 at 8:16 PM, whizvast <whizvast@gmail.com> wrote:
>
> Hi, useRs-
>
> I have been building a set of functions over time and now my R_GlobalEnv
> becomes
> too crowded.
>
> I would like to put all my functions under the same namespace/environment.
> Ideally,
> I would like to call them using "env::func" as in C++.
>
> The following code almost do the jobs I want - except that I need to add
> "env$"
> before defining each function. I can't do that because my functions are
> saved in
> different files.
>
> Anybody has any suggestion? Thx~
>
>
> ## test code ##
> abc <- new.env()
> abc$tmpf <- function() print('hello, world!')
> attach(abc)
>
> abc$tmpf()
> tmpf()
>
>
> --
> View this message in context:
>
http://www.nabble.com/namespace--environment--how-to-manage-functions--tp24100485p24100485.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
[[alternative HTML version deleted]]