[R] Loading .Rdata within an R function

Duncan Murdoch murdoch.duncan at gmail.com
Fri Jul 9 12:16:57 CEST 2010


Giles Crane wrote:
> Thank you for your consideration of this question.
> I have tried both your suggestions.
> However, the data is not loaded within the function.
>
> When I specify load("mydata.Rdata",.globalEnv),
> the data is loaded into the top level environment,
> and the function does access the data in the top level environment.
>
> However, I would like to load the data into the function environment,
> so that the data goes away when the function terminates.
>   

For the benefit of others:  an offline followup showed that the data 
were being loaded in the right place, but a function in a contributed 
package wasn't looking there and didn't see it.


Duncan Murdoch



More information about the R-help mailing list