About
R functionality is divided into a number of packages.
The package contained in the “base” system include utils, stats, datasets, graphics, grDevices, grid, methods, tools, parallel, compiler, splines, tcltk, stats4. And
The package recommended are boot, class, cluster, codetools, foreign, KernSmooth, lattice, mgcv, nlme, rpart, survival, MASS, spatial, nnet, Matrix.
There are about 4000 packages on the CRAN repository
Articles Related
Popularity
- plyrTools for splitting, applying and combining data
- digest Create cryptographic hash digests of R objects
- ggplot2 An implementation of the Grammar of Graphics
- colorspace - Color Space Manipulation
- stringr Make it easier to work with strings
Management
libPath
Search path for package. See R Admin - libPaths
Install
Download and install Package with the following command from cran
install.packages("psych")
install.packages("stringr", dependencies=TRUE)
- From GitHub if not in Cran with devtools.
if (!require('devtools')) install.packages('devtools')
devtools::install_github("ropensci/plotly")
devtools::install_github('apache/[email protected]', subdir='R/pkg')
- From the local disk
cd $PACKAGE
R -e "devtools::install('.')"
See also: librarian - install, update, and attach packages from CRAN and GitHub in the same function call.
Uninstall / Remove
remove.packages(pkgs, lib)
# Example
remove.packages("sparklyr")
where:
- package is a vector
- lib is the repository
Installation location
Package are installed locally on Windows at: USER_HOME\Documents\R\win-library\
Info
utils::packageDescription("RevoUtils")
Package: RevoUtils
Version: 10.0.7
Date: 2018-01-03
RevoBuildID: {10.0.7.0116}
Title: Microsoft R Utility Package
Author: Microsoft Corporation
Maintainer: Microsoft Corporation <[email protected]>
SystemRequirements: R (>= 3.0.0)
Description: Utility functions for Microsoft R
License: GPL-2
Copyright: Microsoft Corporation
MRANDate: 2018-01-01
Built: R 3.4.3; ; 2018-01-02 22:34:00 UTC; windows
-- File: C:/Program Files/Microsoft/ML Server/R_SERVER/library/RevoUtils/Meta/package.rds
get one info
utils::packageDescription("RevoUtils")$MRANDate
[1] "2018-01-01"
Meta
The meta (description) of the package are in the DESCRIPTION file.
Example for sparklyr
Package: sparklyr
Type: Package
Title: R Interface to Apache Spark
Version: 0.5.4
Authors@R: c(
person("Javier", "Luraschi", email = "[email protected]", role = c("aut", "cre")),
person("Kevin", "Ushey", role = "aut", email = "[email protected]"),
person("JJ", "Allaire", role = "aut", email = "[email protected]"),
person(family = "RStudio", role = c("cph")),
person(family = "The Apache Software Foundation", role = c("aut", "cph"))
)
Maintainer: Javier Luraschi <[email protected]>
Description: R interface to Apache Spark, a fast and general engine for big data
processing, see <http://spark.apache.org>. This package supports connecting to
local and remote Apache Spark clusters, provides a 'dplyr' compatible back-end,
and provides an interface to Spark's built-in machine learning algorithms.
License: Apache License 2.0 | file LICENSE
URL: http://spark.rstudio.com
BugReports: https://github.com/rstudio/sparklyr/issues
LazyData: TRUE
RoxygenNote: 6.0.0
Depends: R (>= 3.1.2)
Imports: methods, lazyeval (>= 0.2.0), dplyr (>= 0.5.0), DBI (>= 0.6),
readr (>= 0.2.0), digest, config, rappdirs, assertthat,
rprojroot, withr, httr, jsonlite, base64enc
Suggests: testthat, RCurl, janeaustenr
NeedsCompilation: no
Packaged: 2017-04-25 06:40:26 UTC; javierluraschi
Author: Javier Luraschi [aut, cre],
Kevin Ushey [aut],
JJ Allaire [aut],
RStudio [cph],
The Apache Software Foundation [aut, cph]
Repository: CRAN
Date/Publication: 2017-04-25 07:24:39 UTC
Built: R 3.3.3; ; 2017-04-28 11:22:35 UTC; windows
Load
To load package, use the library function
library(psych)
Unload
detach("package:RJDBC", unload = TRUE)
Verify is a package is loaded
search()
[1] ".GlobalEnv" "tools:rstudio" "package:stats" "package:graphics"
[5] "package:grDevices" "package:utils" "package:datasets" "package:methods"
[9] "Autoloads" "package:base"
Creating a package
https://hilaryparker.com/2014/04/29/writing-an-r-package-from-scratch/amp/
Documentation
Get the help on one package
help(package=boot)