Skip to content

Commit a8968ca

Browse files
committed
Add glass dataset
1 parent 3c42d0e commit a8968ca

File tree

6 files changed

+137
-4
lines changed

6 files changed

+137
-4
lines changed

R/glass_docs.R

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#' Glass Identification Data Set
2+
#'
3+
#' The study of classification of types of glass was motivated by criminological
4+
#' investigation. At the scene of the crime, the glass left can be used as
5+
#' evidence...if it is correctly identified!
6+
#'
7+
#' @format A data frame with 214 observations on the following 11 variables.
8+
#' - `ID`: 1 to 214
9+
#' - `RI`: refractive index
10+
#' - `Na`: weight percent in corresponding oxide, as are attributes 4-10)
11+
#' - `Mg`: Magnesium
12+
#' - `Al`: Aluminum
13+
#' - `Si`: Silicon
14+
#' - `K`: Potassium
15+
#' - `Ca`: Calcium
16+
#' - `Ba`: Barium
17+
#' - `Fe`: Iron
18+
#' - `Type`: Class attribute
19+
#' - 1: building_windows_float_processed
20+
#' - 2: building_windows_non_float_processed
21+
#' - 3: vehicle_windows_float_processed
22+
#' - 4: vehicle_windows_non_float_processed (none in this database)
23+
#' - 5: containers
24+
#' - 6: tableware
25+
#' - 7: headlamps
26+
#' @source
27+
#'
28+
#' B. German
29+
#' Central Research Establishment
30+
#' Home Office Forensic Science Service
31+
#' Aldermaston, Reading, Berkshire RG7 4PN
32+
#'
33+
#' Vina Spiehler, Ph.D., DABFT
34+
#' Diagnostic Products Corporation
35+
#' (213) 776-0180 (ext 3014)
36+
#'
37+
#' @references
38+
#' <https://archive.ics.uci.edu/ml/machine-learning-databases/glass/glass.data>
39+
#' <https://archive.ics.uci.edu/ml/datasets/Glass+Identification>
40+
"glass"

README.Rmd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ knitr::opts_chunk$set(
1414

1515
[![Travis-CI Build Status](https://travis-ci.org/coatless/ucidata.svg?branch=master)](https://travis-ci.org/coatless/ucidata)[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/ucidata)](http://www.r-pkg.org/pkg/ucidata) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/ucidata)](https://cran.r-project.org/package=ucidata)
1616

17-
# `ucidata` - Data Sets from UC Irving's ML Library
17+
# `ucidata` - Data Sets from UC Irvine's ML Library
1818

1919
The following is an _R_ data package that features certain data sets from
20-
the [Machine Learning Library at UC Irving](https://archive.ics.uci.edu/ml/)
20+
the [Machine Learning Library at UC Irvine](https://archive.ics.uci.edu/ml/)
2121
These data sets have been cleaned up and provide documentation via _R_'s help system.
2222

2323
## Installation
@@ -77,6 +77,7 @@ The following data sets are included in the `ucidata` package:
7777
- [`bcw_original` (Breast Cancer Wisconsin Original)](https://archive.ics.uci.edu/ml/datasets/bike+sharing+dataset)
7878
- [`bike_sharing_daily`](https://archive.ics.uci.edu/ml/datasets/bike+sharing+dataset)
7979
- [`bridges`](https://archive.ics.uci.edu/ml/datasets/Pittsburgh+Bridges)
80+
- [`glass`](https://archive.ics.uci.edu/ml/datasets/Glass+Identification)
8081
- [`hepatitis`](https://archive.ics.uci.edu/ml/datasets/hepatitis)
8182
- [`wine`](https://archive.ics.uci.edu/ml/datasets/wine)
8283

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
<!-- README.md is generated from README.Rmd. Please edit that file -->
33
[![Travis-CI Build Status](https://travis-ci.org/coatless/ucidata.svg?branch=master)](https://travis-ci.org/coatless/ucidata)[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/ucidata)](http://www.r-pkg.org/pkg/ucidata) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/ucidata)](https://cran.r-project.org/package=ucidata)
44

5-
`ucidata` - Data Sets from UC Irving's ML Library
5+
`ucidata` - Data Sets from UC Irvine's ML Library
66
=================================================
77

8-
The following is an *R* data package that features certain data sets from the [Machine Learning Library at UC Irving](https://archive.ics.uci.edu/ml/) These data sets have been cleaned up and provide documentation via *R*'s help system.
8+
The following is an *R* data package that features certain data sets from the [Machine Learning Library at UC Irvine](https://archive.ics.uci.edu/ml/) These data sets have been cleaned up and provide documentation via *R*'s help system.
99

1010
Installation
1111
------------
@@ -61,6 +61,7 @@ The following data sets are included in the `ucidata` package:
6161
- [`bcw_original` (Breast Cancer Wisconsin Original)](https://archive.ics.uci.edu/ml/datasets/bike+sharing+dataset)
6262
- [`bike_sharing_daily`](https://archive.ics.uci.edu/ml/datasets/bike+sharing+dataset)
6363
- [`bridges`](https://archive.ics.uci.edu/ml/datasets/Pittsburgh+Bridges)
64+
- [`glass`](https://archive.ics.uci.edu/ml/datasets/Glass+Identification)
6465
- [`hepatitis`](https://archive.ics.uci.edu/ml/datasets/hepatitis)
6566
- [`wine`](https://archive.ics.uci.edu/ml/datasets/wine)
6667

data-raw/glass_build.R

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
### UCI Irvine
2+
## Glass Data https://archive.ics.uci.edu/ml/datasets/Glass+Identification
3+
4+
url_glass = "https://archive.ics.uci.edu/ml/machine-learning-databases/glass/glass.data"
5+
6+
glass = read.csv(url_glass, header = FALSE)
7+
8+
# Columns taken verbatim from ML page
9+
# Regex search with: [0-9]{1,2}\. (.*) / .* / .* / .*
10+
# Replacement: "\1",
11+
var_names = c("ID",
12+
"RI",
13+
"Na",
14+
"Mg",
15+
"Al",
16+
"Si",
17+
"K",
18+
"Ca",
19+
"Ba",
20+
"Fe",
21+
"Type")
22+
23+
# Label column names
24+
colnames(glass) = var_names
25+
26+
glass = within(glass, {
27+
Type = factor(Type, labels = c(
28+
"building_windows_float_processed",
29+
"building_windows_non_float_processed",
30+
"vehicle_windows_float_processed",
31+
# "vehicle_windows_non_float_processed", # none in dataset
32+
"containers",
33+
"tableware",
34+
"headlamps"
35+
))
36+
})
37+
38+
# Save dataset
39+
devtools::use_data(glass, overwrite = TRUE)

data/glass.rda

5.12 KB
Binary file not shown.

man/glass.Rd

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)