Skip to Content
Learning R
book

Learning R

by Richard Cotton
September 2013
Beginner to intermediate
396 pages
8h 8m
English
O'Reilly Media, Inc.
Content preview from Learning R

Chapter 10. Packages

R is not limited to the code provided by the R Core Team. It is very much a community effort, and there are thousands of add-on packages available to extend it. The majority of R packages are currently installed in an online repository called CRAN (the Comprehensive R Archive Network[28]), which is maintained by the R Core Team. Installing and using these add-on packages is an important part of the R experience.

We’ve just seen the plyr package for advanced looping. Throughout the rest of the book, we’ll see many more common packages: lubridate for date and time manipulation, xlsx for importing Excel files, reshape2 for manipulating the shape of data frames, ggplot2 for plotting, and dozens of others.[29]

Chapter Goals

After reading this chapter, you should:

  • Be able to load packages that are installed on your machine
  • Know how to install new packages from local files and via the Internet
  • Understand how to manage the packages on your machine

Loading Packages

To load a package that is already installed on your machine, you call the library function. It is widely agreed that calling this function library was a mistake, and that calling it load_package would have saved a lot of confusion, but the function has existed long enough that it is too late to change it now. To clarify the terminology, a package is a collection of R functions and datasets, and a library is a folder on your machine that stores the files for a package.[30]

If you have a standard version of R—that ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

The Book of R

The Book of R

Tilman M. Davies
The R Book

The R Book

Michael J. Crawley

Publisher Resources

ISBN: 9781449357160Errata Page