Macaulay2 » Documentation
Packages » RInterface :: library
next | previous | forward | backward | up | index | toc

# library -- load an R package

- Usage:
    `library pkg`
- Inputs:
  - pkg, a string,

## Description

This loads an R package. It is an RFunction that calls R's `library` function.

For example, suppose we want to load the `abbey` dataset with nickel content in a Canadian syenite rock. It is available in the `MASS` package.

    i1 : library "MASS"

    o1 = [1] "MASS"      "stats"     "graphics"  "grDevices" "utils"     "datasets"
         [7] "methods"   "base"

    o1 : RObject of type character

    i2 : RSymbol "abbey"

    o2 =  [1]   5.2   6.5   6.9   7.0   7.0   7.0   7.4   8.0   8.0   8.0   8.0   8.5
         [13]   9.0   9.0  10.0  11.0  11.0  12.0  12.0  13.7  14.0  14.0  14.0  16.0
         [25]  17.0  17.0  18.0  24.0  28.0  34.0 125.0

    o2 : RObject of type double

## For the programmer

The object library is an instance of the type RFunction.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/RInterface/doc.m2:856:0.