2 Datasets from R
Every object of the datasets package of R 4.3.3 is imported by datasets-r, linked to equivalent data in datasets-core, or skipped, as the table below records. R’s iris links to the datasets-core iris: the same measurements, with UCI species labels. An imported dataset’s entry is in the R Datasets Catalog; a linked one’s is in the Datasets Core. Imports are mechanical:
Names: a hyphen goes between a lowercase letter or digit and a capital, and before the last capital of a run followed by a lowercase letter; then lowercase, with any other characters as hyphens (state.x77 gives state-x77, UKDriverDeaths gives uk-driver-deaths). Column names follow the same rule. Exceptions: BJsales bj-sales, CO2 co2-uptake (co2 is the Mauna Loa series), DNase dnase, UKgas uk-gas, UScitiesD us-cities-d, WWWusage www-usage.
Types: an R double is real, even when whole; an integer is integer; a factor is categorical; a character vector is a string. Exceptions: character columns given levels on import are categorical, row names and other keys are identifier, and Date and POSIXct values are ISO 8601 strings.
Data frames: columns as in R. Row names that are not numbers become a first identifier column; nlme groupedData attributes are dropped.
Time series: index columns year and, by frequency, quarter, month or business-day (time for series that start at 1 with frequency 1), with time-series metadata. eu-stock-markets is on R’s nominal grid of 260 business days a year, not calendar dates. A univariate series is a value column; a multivariate one has a column per series. Series that share an index are joined: bj-sales and uk-lung-deaths.
Contingency tables: long form, one categorical column per dimension and a count column, one row per cell in R array order, zero cells kept.
Matrices: row names as a first column, an identifier unless they are numbers; volcano in long form (row, column, value). Covariance lists: the cov matrix with a variable column.
Distance matrices: one row per pair of the lower triangle, (from, to, distance).
Vectors: a value column, after a name column for a named vector, an identifier when the names are unique; the state.* objects are joined into state.
R object |
| Class |
| Dataset |
ability.cov |
| list |
| ability-cov |
airmiles |
| ts |
| airmiles |
AirPassengers |
| ts |
| air-passengers |
airquality |
| data.frame |
| airquality |
anscombe |
| data.frame |
| anscombe |
attenu |
| data.frame |
| attenu |
attitude |
| data.frame |
| attitude |
austres |
| ts |
| austres |
beaver1 |
| data.frame |
| beaver1 |
beaver2 |
| data.frame |
| beaver2 |
BJsales |
| ts |
| bj-sales |
BJsales.lead |
| ts |
| bj-sales |
BOD |
| data.frame |
| bod |
cars |
| data.frame |
| cars |
ChickWeight |
| nfnGroupedData/nfGroupedData/groupedData/data.frame |
| chick-weight |
chickwts |
| data.frame |
| chickwts |
CO2 |
| nfnGroupedData/nfGroupedData/groupedData/data.frame |
| co2-uptake |
co2 |
| ts |
| co2 |
crimtab |
| table |
| crimtab |
discoveries |
| ts |
| discoveries |
DNase |
| nfnGroupedData/nfGroupedData/groupedData/data.frame |
| dnase |
esoph |
| data.frame |
| esoph |
euro |
| numeric |
| euro |
euro.cross |
| matrix/array |
| Skipped. Derived from euro: euro.cross[i, j] is euro[j] / euro[i]. |
eurodist |
| dist |
| eurodist |
EuStockMarkets |
| mts/ts/matrix/array |
| eu-stock-markets |
faithful |
| data.frame |
| faithful |
fdeaths |
| ts |
| uk-lung-deaths |
Formaldehyde |
| data.frame |
| formaldehyde |
freeny |
| data.frame |
| freeny |
freeny.x |
| matrix/array |
| Skipped. The four regressor columns of freeny. |
freeny.y |
| ts |
| Skipped. The y column of freeny. |
HairEyeColor |
| table |
| hair-eye-color |
Harman23.cor |
| list |
| harman23-cor |
Harman74.cor |
| list |
| harman74-cor |
Indometh |
| nfnGroupedData/nfGroupedData/groupedData/data.frame |
| indometh |
infert |
| data.frame |
| infert |
InsectSprays |
| data.frame |
| insect-sprays |
iris |
| data.frame |
| iris |
iris3 |
| array |
| Skipped. The iris measurements (datasets-core iris) as a 50 x 4 x 3 array. |
islands |
| numeric |
| islands |
JohnsonJohnson |
| ts |
| johnson-johnson |
LakeHuron |
| ts |
| lake-huron |
ldeaths |
| ts |
| uk-lung-deaths |
lh |
| ts |
| lh |
LifeCycleSavings |
| data.frame |
| life-cycle-savings |
Loblolly |
| nfnGroupedData/nfGroupedData/groupedData/data.frame |
| loblolly |
longley |
| data.frame |
| longley |
lynx |
| ts |
| lynx |
mdeaths |
| ts |
| uk-lung-deaths |
morley |
| data.frame |
| morley |
mtcars |
| data.frame |
| mtcars |
nhtemp |
| ts |
| nhtemp |
Nile |
| ts |
| nile |
nottem |
| ts |
| nottem |
npk |
| data.frame |
| npk |
occupationalStatus |
| table |
| occupational-status |
Orange |
| nfnGroupedData/nfGroupedData/groupedData/data.frame |
| orange |
OrchardSprays |
| data.frame |
| orchard-sprays |
PlantGrowth |
| data.frame |
| plant-growth |
precip |
| numeric |
| precip |
presidents |
| ts |
| presidents |
pressure |
| data.frame |
| pressure |
Puromycin |
| data.frame |
| puromycin |
quakes |
| data.frame |
| quakes |
randu |
| data.frame |
| randu |
rivers |
| numeric |
| rivers |
rock |
| data.frame |
| rock |
Seatbelts |
| mts/ts/matrix/array |
| seatbelts |
sleep |
| data.frame |
| sleep |
stack.loss |
| numeric |
| Skipped. The stack-loss column of stackloss. |
stack.x |
| matrix/array |
| Skipped. The three regressor columns of stackloss. |
stackloss |
| data.frame |
| stackloss |
state.abb |
| character |
| state |
state.area |
| numeric |
| state |
state.center |
| list |
| state |
state.division |
| factor |
| state |
state.name |
| character |
| state |
state.region |
| factor |
| state |
state.x77 |
| matrix/array |
| state |
sunspot.month |
| ts |
| sunspot-month |
sunspot.year |
| ts |
| sunspot-year |
sunspots |
| ts |
| sunspots |
swiss |
| data.frame |
| swiss |
Theoph |
| nfnGroupedData/nfGroupedData/groupedData/data.frame |
| theoph |
Titanic |
| table |
| titanic |
ToothGrowth |
| data.frame |
| tooth-growth |
treering |
| ts |
| treering |
trees |
| data.frame |
| trees |
UCBAdmissions |
| table |
| ucb-admissions |
UKDriverDeaths |
| ts |
| uk-driver-deaths |
UKgas |
| ts |
| uk-gas |
USAccDeaths |
| ts |
| us-acc-deaths |
USArrests |
| data.frame |
| us-arrests |
UScitiesD |
| dist |
| us-cities-d |
USJudgeRatings |
| data.frame |
| us-judge-ratings |
USPersonalExpenditure |
| matrix/array |
| us-personal-expenditure |
uspop |
| ts |
| uspop |
VADeaths |
| matrix/array |
| va-deaths |
volcano |
| matrix/array |
| volcano |
warpbreaks |
| data.frame |
| warpbreaks |
women |
| data.frame |
| women |
WorldPhones |
| matrix/array |
| world-phones |
WWWusage |
| ts |
| www-usage |
2.1 ggplot2
datasets-r also bundles the eleven data sets of ggplot2 4.0.3 (MIT) under the rules above. Ordered factors are categorical with levels in R order: diamonds cut runs from Fair to Ideal, color from D to J and clarity from I1 to IF. faithfuld is a density estimate on a grid, not R’s faithful; mpg is EPA fuel economy for 1999 and 2008 models, not the UCI auto-mpg.
R object |
| Dataset |
| Rows |
| Columns |
diamonds |
| diamonds |
| 53940 |
| 10 |
economics |
| economics |
| 574 |
| 6 |
economics_long |
| economics-long |
| 2870 |
| 4 |
faithfuld |
| faithfuld |
| 5625 |
| 3 |
luv_colours |
| luv-colours |
| 657 |
| 4 |
midwest |
| midwest |
| 437 |
| 28 |
mpg |
| mpg |
| 234 |
| 11 |
msleep |
| msleep |
| 83 |
| 11 |
presidential |
| presidential |
| 12 |
| 4 |
seals |
| seals |
| 1155 |
| 4 |
txhousing |
| txhousing |
| 8602 |
| 9 |