In this page, we will learn data()
function that shows 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 included in the base installation of R. 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.
You can see the document of data()
function at the following link:
Copy and Run the sample code in your RStudio to see how data() function works.
# DO NOT RUN HERE
# Copy and Run the sample code in your RStudio.
# list all available data sets
data()
# print iris dataset
iris