Skip to content

Commit e3c93ac

Browse files
committed
Add bridge data
1 parent b7d33ee commit e3c93ac

File tree

6 files changed

+173
-2
lines changed

6 files changed

+173
-2
lines changed

R/bridges_docs.R

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#' Pittsburgh Bridges Data Set
2+
#'
3+
#' Data containing examples of Pittsburgh bridges and the relevant surrounding
4+
#' area.
5+
#'
6+
#' @format A data frame with 108 observations on the following 13 variables.
7+
#' - `identif`
8+
#' - identifier of the examples
9+
#' - `river`
10+
#' - A, M, O
11+
#' - `location`
12+
#' - Location of Bridge
13+
#' - `erected`
14+
#' - Year built
15+
#' - `purpose`
16+
#' - WALK, AQUEDUCT, RR, HIGHWAY
17+
#' - `length`
18+
#' - 804 - 4558
19+
#' - `lanes`
20+
#' - 1, 2, 4, 6
21+
#' - `clear_g`
22+
#' - N, G
23+
#' - `t_or_d`
24+
#' - THROUGH, DECK
25+
#' - `material`
26+
#' - WOOD, IRON, STEEL
27+
#' - `span`
28+
#' - SHORT, MEDUIM, LONG
29+
#' - `rel_l`
30+
#' - S, S-F, F
31+
#' - `type`
32+
#' - WOOD, SUSPEN, SIMPLE-T, ARCH, CANTILEV, CONT-T
33+
#' @details
34+
#' This data set is non-discretized, meaning the numeric properties
35+
#' were left intact.
36+
#' @source
37+
#' Yoram Reich & Steven J. Fenves
38+
#' Department of Civil Engineering
39+
#' and
40+
#' Engineering Design Research Center
41+
#' Carnegie Mellon University
42+
#' Pittsburgh, PA 15213
43+
#' @references
44+
#' <https://archive.ics.uci.edu/ml/machine-learning-databases/bridges/bridges.data.version1>
45+
#' <https://archive.ics.uci.edu/ml/datasets/Pittsburgh+Bridges>
46+
"bridges"

README.Rmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ The following data sets are included in the `ucidata` package:
7373
- [`adult`](https://archive.ics.uci.edu/ml/datasets/adult)
7474
- [`autoimports`](https://archive.ics.uci.edu/ml/datasets/Automobile)
7575
- [`autompg`](https://archive.ics.uci.edu/ml/datasets/auto+mpg)
76-
- [`bike_sharing_daily`](https://archive.ics.uci.edu/ml/datasets/bike+sharing+dataset)
7776
- Breast Cancer Wisconsin:
7877
- [`bcw_original` (Breast Cancer Wisconsin Original)](https://archive.ics.uci.edu/ml/datasets/bike+sharing+dataset)
78+
- [`bike_sharing_daily`](https://archive.ics.uci.edu/ml/datasets/bike+sharing+dataset)
79+
- [`bridges`](https://archive.ics.uci.edu/ml/datasets/Pittsburgh+Bridges)
7980
- [`wine`](https://archive.ics.uci.edu/ml/datasets/wine)
8081

8182
## Build Scripts

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ The following data sets are included in the `ucidata` package:
5757
- [`adult`](https://archive.ics.uci.edu/ml/datasets/adult)
5858
- [`autoimports`](https://archive.ics.uci.edu/ml/datasets/Automobile)
5959
- [`autompg`](https://archive.ics.uci.edu/ml/datasets/auto+mpg)
60-
- [`bike_sharing_daily`](https://archive.ics.uci.edu/ml/datasets/bike+sharing+dataset)
6160
- Breast Cancer Wisconsin:
6261
- [`bcw_original` (Breast Cancer Wisconsin Original)](https://archive.ics.uci.edu/ml/datasets/bike+sharing+dataset)
62+
- [`bike_sharing_daily`](https://archive.ics.uci.edu/ml/datasets/bike+sharing+dataset)
63+
- [`bridges`](https://archive.ics.uci.edu/ml/datasets/Pittsburgh+Bridges)
6364
- [`wine`](https://archive.ics.uci.edu/ml/datasets/wine)
6465

6566
Build Scripts

data-raw/bridges_build.R

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## UCI Data
2+
# Pittsburgh Bridges Data https://archive.ics.uci.edu/ml/datasets/Pittsburgh+Bridges
3+
4+
url_bridges = "https://archive.ics.uci.edu/ml/machine-learning-databases/bridges/bridges.data.version1"
5+
6+
bridges = read.csv(url_bridges,
7+
header = FALSE, na.strings = "?")
8+
9+
# Columns taken verbatim from ML page
10+
# Regex search with: [0-9]{1,2}\. (.*) / .* / .* / .*
11+
# Replacement: "\1",
12+
var_names = c(
13+
"IDENTIF",
14+
"RIVER",
15+
"LOCATION",
16+
"ERECTED",
17+
"PURPOSE",
18+
"LENGTH",
19+
"LANES",
20+
"CLEAR-G",
21+
"T-OR-D",
22+
"MATERIAL",
23+
"SPAN",
24+
"REL-L",
25+
"TYPE"
26+
)
27+
28+
# Label columns
29+
colnames(bridges) = gsub("-", "_", tolower(var_names))
30+
31+
# Switch from numeric to factor:
32+
bridges = within(bridges, {
33+
erected = factor(erected)
34+
lanes = factor(lanes)
35+
})
36+
37+
devtools::use_data(bridges, overwrite = TRUE)
38+

data/bridges.rda

1.87 KB
Binary file not shown.

man/bridges.Rd

Lines changed: 85 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)