install.packages(): install packages easily

In this page, we will learn prebuilt datasets in R. data() function will show the list of all datasets in your workspace. data() is a function within a "utils" package in "base" version of R installation so that you do not need to install any package to run this.

When you install R in your computer, the package "datasets" is installed. Datasets in the package "datasets" are provided openly and free. These datasets can be used when you want to verify your statistical methods. When you install some packages that include datasets, data() function will show the datasets in the packages.

help() function can be used to find out how the dataset is such as help(iris).

You can see the document of data() function at the following link:

  • install.packages() : install pacakges
  • Instruction

    Copy and Run the sample code in your Rstudio to see how install.packages() function works.

    DO NOT CLICK RUN

    # DO NOT RUN THIS CODE IN THE ENVIRONMENT # INSTEAD, COPY AND PASTE IN RSTUDIO TO PRACTICE THIS CODE # install a package "dplyr" install.packages("dplyr") # install packages only when it is not installed if(!require("ggplot2")) install.packages("ggplot2")

    Previous: 1-6 | help(): Help document for pre-built functions

    Next: 1-8 | library(): load installed packages

    Back to Main