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)

    packageSlot(object)
    packageSlot(object) <- value

### Arguments

`where` | the environment or position on the search list associated with the desired package.
`object` | object providing a character string name, plus the package in which this object is to be found.
`value` | the name of the package.

### 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

`packageName` return the character-string name of the package (without the extraneous `"package:"` found in the search list).
`packageSlot` returns or sets the package name slot (currently an attribute, not a formal slot, but this will likely change).

### See Also

`search`

### Examples

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

[Package methods version 2.3.1 Index]