Skip to content
Back to formatted view

Raw Message

Message-ID: <20331330-35BA-40C7-94A4-7B94BD9539A2@micromata.de>
Date: 2012-07-11T15:01:50Z
From: Jessica Streicher
Subject: define stuff to be only usable in the same file
In-Reply-To: <CANVKczNV59otkPoz2dTm8LybU+SPrSne8c6MN+gkG1yOu9bTVA@mail.gmail.com>

Thanks Barry, that helped a lot, modified it a bit and it does pretty much what i wanted.

On 11.07.2012, at 15:08, Barry Rowlingson wrote:

> On Tue, Jul 10, 2012 at 4:02 PM, Jessica Streicher
> <j.streicher at micromata.de> wrote:
> 
>> 
>> Forget about that, i'm stupid and can't use the tools available...
>> 
> 
> Here's something I wrote specially for all you wonderful stupid
> people out there...
> 
> https://gist.github.com/3025606
> 
> What it tries to do is to wrap all the messy business of loading
> functions from an R file into a separate place on your search path.
> You just do:
> 
> tach("foo.R")
> 
> and anything defined in foo.R will be usable but not visible when you do ls().
> 
> If you edit and save foo.R then just do retach() to rescan all the .R
> files you might have tached earlier.
> 
> Stuff in your ls() environment can mask stuff attached via tach, so
> watch out for that.
> 
> Barry
> 
> 
> [
> technical note:
>  all it does is to source the file into an environment, and attach
> that environment. The environment is S3-superclassed so that retach
> can do its business
> ]