How can I see what data sets are available when I start R?

How can I see what data sets are available when I start R?

When starting R, you can use the `data()` function to view a list of available data sets. This will display the names of all built-in data sets that are included in the R software. Additionally, you can also check the documentation or search online for external data sets that can be imported into R for analysis. This allows you to easily explore and access a wide range of data sources for your statistical and data analysis needs.

How can I see what data sets are available when I start R? | R FAQ

Once you start your R program, there are example data sets available
within R along with loaded packages.  You can list the data sets by
their names and then load a data set into memory to be used in your
statistical analysis. For example, in the book “Modern
Applied Statistics with S” a data set called phones is used in
Chapter 6 for robust regression and we want to use the same data set for our
own examples. Here is how to locate the data set and load it into R.

Command library loads the package MASS (for Modern Applied
Statistics with S) into memory. Command data() will list all the
datasets in loaded packages. The command data(phones) will load the data
set phones into memory.

library(MASS)
data()

Data sets in package 'datasets':
AirPassengers           Monthly Airline Passenger Numbers 1949-1960
BJsales                 Sales Data with Leading Indicator
BJsales.lead (BJsales)
                        Sales Data with Leading Indicator
BOD                     Biochemical Oxygen Demand
CO2                     Carbon Dioxide uptake in grass plants
ChickWeight             Weight versus age of chicks on different diets
DNase                   Elisa assay of DNase
EuStockMarkets          Daily Closing Prices of Major European Stock
                        Indices, 1991-1998
........ (more data sets in between are omitted.)
uspop                   Populations Recorded by the US Census
volcano                 Topographic Information on Auckland's Maunga
                        Whau Volcano
warpbreaks              The Number of Breaks in Yarn during Weaving
women                   Average Heights and Weights for American Women
Data sets in package 'MASS':
Aids2                   Australian AIDS Survival Data
Animals                 Brain and Body Weights for 28 Species
... (more data sets are omitted here)
oats                    Data from an Oats Field Trial
painters                The Painter's Data of de Piles
petrol                  N. L. Prater's Petrol Refinery Data
phones                  Belgium Phone Calls 1950-1973
quine                   Absenteeism from School in Rural New South
                        Wales
... (more data sets are omitted here)

Use 'data(package = .packages(all.available = TRUE))'
to list the data sets in all *available* packages.

data(phones)

phones

$year
 [1] 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
$calls
 [1]   4.4   4.7   4.7   5.9   6.6   7.3   8.1   8.8  10.6  12.0  13.5  14.9
[13]  16.1  21.2 119.0 124.0 142.0 159.0 182.0 212.0  43.0  24.0  27.0  29.0

Cite this article

stats writer (2024). How can I see what data sets are available when I start R?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-see-what-data-sets-are-available-when-i-start-r/

stats writer. "How can I see what data sets are available when I start R?." PSYCHOLOGICAL SCALES, 30 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-see-what-data-sets-are-available-when-i-start-r/.

stats writer. "How can I see what data sets are available when I start R?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-see-what-data-sets-are-available-when-i-start-r/.

stats writer (2024) 'How can I see what data sets are available when I start R?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-see-what-data-sets-are-available-when-i-start-r/.

[1] stats writer, "How can I see what data sets are available when I start R?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I see what data sets are available when I start R?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top