Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How To get a list of in-built DataSets in R?

Do you have trouble getting a sample DataSet while practicing R? I did! But now, I have learned that there are some in-built Datasets in R which we can use for practice. So, now it is easy to play around with the different datasets. 

Problem:
How to get a list of in-built DataSets in R?
Solution:
1. Using data(), we can get a list of all the available datasets. We might have Installed some packages while learning and practicing R. data() function will list the datasets of all loaded packages. We can see the packages that we have already loaded in our RStudio 'packages' window and are checked like below:
So, there is a package for R datasets named as 'datasets'. if we type data() in our console, we will be able to see the datasets available for all the loaded packages like datasets, carData,dplyr etc. for the above example.
2: Using data(package = .packages(all.available = TRUE)), we can get a list of all datasets in the available packages (i.e. also the not-loaded ones).
3: Using data(package = "package name"), we can get the datasets of that specific package i.e. data(package = "datasets") will list the datasets from the "dataset" package.



This post first appeared on What The Data Says, please read the originial post: here

Share the post

How To get a list of in-built DataSets in R?

×

Subscribe to What The Data Says

Get updates delivered right to your inbox!

Thank you for your subscription

×