Learn R Programming

R.oo (version 1.26.0)

Package: The Package class provides methods for accessing package information

Description

Package: R.oo
Class Package

Object
~~|
~~+--Package

Directly known subclasses:

public class Package
extends Object

Creates a Package that can be thrown and caught. The Package class is the root class of all other Package classes.

Usage

Package(name=NULL)

Arguments

name

Name of the package.

Fields and Methods

Methods:

as.characterGets a string representation of this package.
getAuthorGets the Author of this package.
getBundleGets the Bundle that this package might belong to.
getBundlePackagesGets the names of the other packages that is in the same bundle as this package.
getChangeLogGets the change log of this package.
getClassesGets all classes of a package.
getContentsGets the contents of this package.
getContribUrlGets the URL(s) from where this package can be installed.
getDataPathGets the path to the data (data/) directory of this package.
getDateGets the date when package was build.
getDescriptionGets the description of the package.
getDescriptionFileGets the description file of this package.
getDevelUrlGets the URL(s) from where the developers version of this package can be installed.
getDocPathGets the path to the accompanying documentation (doc/) directory of this package.
getEnvironmentGets the environment of a loaded package.
getExamplePathGets the path to the example (R-ex/) directory of this package.
getHistory-
getHowToCiteGets the citation of this package.
getLicenseGets the License of this package.
getMaintainerGets the Maintainer of this package.
getNameGets the name of this package.
getNews-
getPathGets the library (system) path to this package.
getPositionGets the search path position of the package.
getTitleGets the Title of this package.
getUrlGets the URL of this package.
getVersionGets the version of this package.
isLoadedChecks if the package is installed on the search path or not.
isOlderThanChecks if the package is older than a given version.
llGenerates a list of informative properties of all members of the package.
loadLoads a package.
showChangeLogShow the change log of this package.
showContentsShow the CONTENTS file of this package.
showDescriptionFileShow the DESCRIPTION file of this package.
showHistory-
showHowToCiteShow the HOWTOCITE file of this package.
showNews-
startupMessageGenerates a 'package successfully loaded' package startup message.
unloadUnloads a package.

Methods inherited from Object:
$, $<-, [[, [[<-, as.character, attach, attachLocally, clearCache, clearLookupCache, clone, detach, equals, extend, finalize, getEnvironment, getFieldModifier, getFieldModifiers, getFields, getInstantiationTime, getStaticInstance, hasField, hashCode, ll, load, names, objectSize, print, save

Author

Henrik Bengtsson

Examples

Run this code
if (FALSE) # By defining .onAttach() as follows in zzz.R for a package, an
# instance of class Package with the same name as the package will
# be made available on the search path. More over, the code below
# will also inform the user that the package has been loaded:
#
#  > library(R.oo)
#  R.oo v0.52 (2003/04/13) was successfully loaded.
#
.onAttach <- function(libname, pkgname) {
  pkg <- Package(pkgname)
  assign(pkgname, pkg, pos=getPosition(pkg))
  cat(getName(pkg), " v", getVersion(pkg), " (", getDate(pkg), ")",
    " was successfully loaded.\n", sep="")
}

# The Package class works for any packages, loaded or not.

# Some information about the base package
pkg <- Package("base")
print(pkg)
# [1] "Package: base v3.6.2 is loaded (pos=14).  Title: The R Base Package.
# The official webpage is NA and the maintainer is R Core Team .  The package is installed in /usr/lib/R/library/base/.
# License: Part of R 3.6.2.  Description: Base R functions.  Type
# showNews(base) for package history, and ?base for help."
print(list.files(Package("base")$dataPath))

# Some information about the R.oo package
print(R.oo::R.oo)
# [1] "Package: R.oo v1.23.0-9000 .  Title: R Object-Oriented Programming
# with or without References.  The official webpage is https://github.com/
# HenrikBengtsson/R.oo and the maintainer is Henrik Bengtsson.  The package
# is installed in /home/alice/R/x86_64-pc-linux-gnu-library/3.6/R.oo/.
# License: LGPL (>= 2.1).  Description: Methods and classes for object-
# oriented programming in R with or without references.  Large effort has
# been made on making definition of methods as simple as possible with a
# minimum of maintenance for package developers.  The package has been
# developed since 2001 and is now considered very stable.  This is a
# cross-platform package implemented in pure R that defines standard S3
# classes without any tricks.  Type showNews(R.oo) for package history,
# and ?R.oo for help."

Run the code above in your browser using DataLab