[R] Quickie : unload library

Sarah Goslee sarah.goslee at gmail.com
Fri Aug 25 22:23:59 CEST 2006


Hi,

There are two ways that I know of:
detach("package:zoo")
or use detach() with the number of that package's
place in the search list.

> library(zoo)
> search()
 [1] ".GlobalEnv"        "package:zoo"       "package:methods"
 [4] "package:graphics"  "package:grDevices" "package:utils"
 [7] "package:datasets"  "package:ecoutils"  "package:ecodist"
[10] "package:stats"     "package:gtkDevice" "Autoloads"
[13] "package:base"
> detach("package:zoo")
> search()
 [1] ".GlobalEnv"        "package:methods"   "package:graphics"
 [4] "package:grDevices" "package:utils"     "package:datasets"
 [7] "package:ecoutils"  "package:ecodist"   "package:stats"
[10] "package:gtkDevice" "Autoloads"         "package:base"

OR

> library(zoo)
> search()
 [1] ".GlobalEnv"        "package:zoo"       "package:methods"
 [4] "package:graphics"  "package:grDevices" "package:utils"
 [7] "package:datasets"  "package:ecoutils"  "package:ecodist"
[10] "package:stats"     "package:gtkDevice" "Autoloads"
[13] "package:base"
> detach(2)
> search()
 [1] ".GlobalEnv"        "package:methods"   "package:graphics"
 [4] "package:grDevices" "package:utils"     "package:datasets"
 [7] "package:ecoutils"  "package:ecodist"   "package:stats"
[10] "package:gtkDevice" "Autoloads"         "package:base"

Sarah

-- 
Sarah Goslee
http://www.stringpage.com



More information about the R-help mailing list