[R] Loading .Rdata within an R function

David Winsemius dwinsemius at comcast.net
Fri Jul 9 00:12:12 CEST 2010


On Jul 8, 2010, at 3:21 PM, Giles Crane wrote:

> Colleagues:
>
> I am having trouble loading data from within .Rdata file
> within the environment of a function.  That is,
> the following always loads to the global environment:
>
>   f1 <- function()    {
>           load("mydata.Rdata")
>           #  compute with objects from mydata.Rdata.
>           }
>
> I wish to load mydata.Rdata only within the function f1.
> Perhaps I have misunderstood the capabilities of load(),
> or the environment concepts.

How do you know that you are having troubles? I don't see any error  
messages.

>

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list