getPackageName(where, create = TRUE) setPackageName(pkg, env)packageSlot(object) packageSlot(object) <- value
TRUEand no non-empty package name is found, the current date and time are used as a package name, and a warning is issued. The created name is stored in the environment if that environment is not locked.
pkgthe internal package name for all computations that set class and method definitions in environment
getPackageNamereturns the character-string name of the package (without the extraneous
"package:"found in the search list).
packageSlotreturns or sets the package name slot (currently an attribute, not a formal slot, but this may change someday).
setPackageNamecan be used to establish a package name in an environment that would otherwise not have one. This allows you to create classes and/or methods in an arbitrary environment, but it is usually preferable to create packages by the standard R programming tools (
libraryfunction. (Currently, the name is stored as the object
.packageNamebut don't trust this for the future.)
## all the following usually return "base" getPackageName(length(search())) getPackageName(baseenv()) getPackageName(asNamespace("base")) getPackageName("package:base")
Run the code above in your browser using DataCamp Workspace