R - Package

Card Puncher Data Processing

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

Popularity

  1. plyrTools for splitting, applying and combining data
  2. digest Create cryptographic hash digests of R objects
  3. ggplot2 An implementation of the Grammar of Graphics
  4. colorspace - Color Space Manipulation
  5. 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:

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)

Documentation / Reference





Discover More
Card Puncher Data Processing
R

is a language and environment for statistical computing and graphics. Syntax is very similar to the S_(programming_language)S language. S is a language that was developed by John Chambers et al. at Bell...
Card Puncher Data Processing
R - (Package) Repository

Package repository Cran is th default repository: CRAN. see also: as Example...
Histogram Density
R - Density

The density function This function computes kernel density estimates. The algorithm used in density.default disperses the mass of the empirical distribution function over a regular grid of at least 512...
Card Puncher Data Processing
R - File System (File, Directory)

in R See also: system.file {base} to finds the full file names of files in packages etc. To get the working directory, use the function getwd To set the working directory, use the function...
Card Puncher Data Processing
R - Function

Functions are stored as R objects with the class function Functions can be: used as arguments of other functions nested where: arglist is a list of argument including the three dot argument....
Card Puncher Data Processing
R - Help

How to get help in R The reference card gives a good way to have all important functions on one place. Will return as message: You...
Card Puncher Data Processing
R - Require

R - Require
Card Puncher Data Processing
R Admin - libPaths

Search path for package Add a path to libPath



Share this page:
Follow us:
Task Runner