R search Function


search() function gets the list of attached packages in the R Search Path.

The default packages in the search path:

>search()
[1] ".GlobalEnv"        "package:stats"     "package:graphics" 
[4] "package:grDevices" "package:utils"     "package:datasets" 
[7] "package:methods"   "Autoloads"         "package:base" 

Attach BOD to the search path:
>attach(BOD)
>search()
 [1] ".GlobalEnv"        "BOD"               "package:stats"    
 [4] "package:graphics"  "package:grDevices" "package:utils"    
 [7] "package:datasets"  "package:methods"   "Autoloads"        
[10] "package:base"   

To list the full path of the packages:
>searchpath()
 [1] ".GlobalEnv"                                   
 [2] "BOD"                                          
 [3] "C:/Program Files/R/R-2.15.2/library/stats"    
 [4] "C:/Program Files/R/R-2.15.2/library/graphics" 
 [5] "C:/Program Files/R/R-2.15.2/library/grDevices"
 [6] "C:/Program Files/R/R-2.15.2/library/utils"    
 [7] "C:/Program Files/R/R-2.15.2/library/datasets" 
 [8] "C:/Program Files/R/R-2.15.2/library/methods"  
 [9] "Autoloads"                                    
[10] "C:/PROGRA~1/R/R-215~1.2/library/base"