I am a newbie to package development in R. I learnt that there are differences between code in scripts and packages. When we use `source()` to load script each line of code is executed. But in case of packages codes are executed when they are built and results are saved. Next time when we load the package using `library()` or `require()` the cached results are available to us.

I created a script `time.R`. Script contains a single instruction as shown:

```
> ctime <- Sys.time()

```

My aim is to load and save the script in a new environment. Later on load it to verify that the time stored in `ctime` is not current time but actually the time when it was loaded.

```
> env <- new.env(parent = emptyenv())
> source('ctime.R',local = env)
  Error in eval(expr, envir, enclos) : could not find function "<-"

```

May be the error is because of using a new environment. Please help how to solve this problem.