Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

The R community is extremely active.

Its members create and contribute useful


new packages all the time to CRAN (the Comprehensive R Archive Network). So it’s
not the case that every R package is on the RStudio Packages tab.
When you find out about a new package that you think might be helpful, it’s easy
to install it into your library. I illustrate by installing ggplot2, a useful
package
that extends R’s graphics capabilities.
One way to install it is via the Packages tab. (Refer to Figure 2-2.) Click on the
Install icon in the upper left corner of the tab. This opens the Install Packages
dialog box, shown in Figure 2-11.
Another way to open the Install Packages dialog box is to select Install Packages
from the Tools menu in the menu bar at the top of RStudio.
In the Packages field, I’ve typed ggplot2 . Click Install, and the following line
appears in the Console pane:
> install.packages(“ggplot2”)
It’s difficult to see this line, however, because lots of other things happen imme-
diately in the Console pane and in onscreen status bars. When all that has
finished,
ggplot2 is on the Packages tab. The final step is to click the check box next to
ggplot2 in order to put it in the library. Then you can use the package. Figure 2-
12
shows the Packages tab with ggplot2 and the checked box.

You might also like