This help topic is for R version 1.7.1. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/methods/html/getPackageName.html
getPackageName {methods}R Documentation

The name associated with a given package

Description

The functions below produce the package associated with a particular environment or position on the search list, or of the package containing a particular function. They are primarily used to support computations that need to differentiate objects on multiple packages.

Usage

getPackageName(where = 1)
functionPackageName(name)

Arguments

where

The environment or position on the search list associated with the desired package.

name

The name of a function: functionPackageName finds the function and returns the package name corresponding. Note that if there are multiple instances of the function, all the corresponding names are returned.

Details

Package names are normally installed during loading of the package, by the INSTALL script or by the library function. (Currently, the name is stored as the object .packageName but don't trust this for the future.)

Value

All the functions return the character-string name of the package (without the extraneous "package:" found in the search list).

See Also

search

Examples

## both the following usually return "base"
getPackageName(length(search()))

functionPackageName("rnorm")

[Package methods version 1.7.1 ]