Understanding Repositories and Libraries

Packages live in one of two places: repositories and libraries. Packages get to libraries from repositories by installation.

Think of your data science workbench as a kitchen:

  • The repository is the grocery store, a central place to get packages.

  • The library is the pantry, where you keep your own private set of packages.

  • Installation is the shopping trip to stock your library from the repository.

Like the grocery store, the package repository includes more packages – inert and boxed up – than any one person needs. Common repositories include CRAN, BioConductor, PyPI, private Package Manager, and public Package Manager.

graphic showing Repository installing to Library

And like the pantry in your home, which holds shelf-stable ingredients until they’re needed in the kitchen, the library holds packages specific to your work, ready for you to combine with other raw ingredients for your analysis.

Libraries are needed wherever there’s a running R or Python process, like within the RStudio IDE and Jupyter Notebooks, or alongside apps and reports running on platforms like Connect.

Unlike your ability to choose among various colors or flavors of the same item in your pantry, R and Python find packages in the library by name alone, so the library that corresponds to your code must include:

Originally posted on the Posit blog.

Back to top