Skip to content

Commit 0d9e5a2

Browse files
committed
Fix autoimports variable names
1 parent e3c93ac commit 0d9e5a2

File tree

4 files changed

+39
-34
lines changed

4 files changed

+39
-34
lines changed

R/autoimports_docs.R

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,56 +17,56 @@
1717
#' @format A data frame with 205 observations on the following 26 variables.
1818
#' - `symboling`:
1919
#' - -3, -2, -1, 0, 1, 2, 3.
20-
#' - `normalized-losses`:
20+
#' - `normalized_losses`:
2121
#' - continuous from 65 to 256.
2222
#' - `make`:
2323
#' - alfa-romero, audi, bmw, chevrolet, dodge, honda, isuzu,
2424
#' jaguar, mazda, mercedes-benz, mercury, mitsubishi, nissan,
2525
#' peugot, plymouth, porsche, renault, saab, subaru, toyota, volkswagen,
2626
#' volvo
27-
#' - `fuel-type`:
27+
#' - `fuel_type`:
2828
#' - diesel, gas.
2929
#' - `aspiration`:
3030
#' - std, turbo.
31-
#' - `num-of-doors`:
31+
#' - `num_of_doors`:
3232
#' - four, two.
33-
#' - `body-style`:
33+
#' - `body_style`:
3434
#' - hardtop, wagon, sedan, hatchback, convertible.
35-
#' - `drive-wheels`:
35+
#' - `drive_wheels`:
3636
#' - 4wd, fwd, rwd.
37-
#' - `engine-location`:
37+
#' - `engine_location`:
3838
#' - front, rear.
39-
#' - `wheel-base`:
39+
#' - `wheel_base`:
4040
#' - continuous from 86.6 120.9.
4141
#' - `length`:
4242
#' - continuous from 141.1 to 208.1.
4343
#' - `width`:
4444
#' - continuous from 60.3 to 72.3.
4545
#' - `height`:
4646
#' - continuous from 47.8 to 59.8.
47-
#' - `curb-weight`:
47+
#' - `curb_weight`:
4848
#' - continuous from 1488 to 4066.
49-
#' - `engine-type`:
49+
#' - `engine_type`:
5050
#' - dohc, dohcv, l, ohc, ohcf, ohcv, rotor.
51-
#' - `num-of-cylinders`:
51+
#' - `num_of_cylinders`:
5252
#' - eight, five, four, six, three, twelve, two.
53-
#' - `engine-size`:
53+
#' - `engine_size`:
5454
#' - continuous from 61 to 326.
55-
#' - `fuel-system`:
55+
#' - `fuel_system`:
5656
#' - 1bbl, 2bbl, 4bbl, idi, mfi, mpfi, spdi, spfi.
5757
#' - `bore`:
5858
#' - continuous from 2.54 to 3.94.
5959
#' - `stroke`:
6060
#' - continuous from 2.07 to 4.17.
61-
#' - `compression-ratio`:
61+
#' - `compression_ratio`:
6262
#' - continuous from 7 to 23.
6363
#' - `horsepower`:
6464
#' - continuous from 48 to 288.
65-
#' - `peak-rpm`:
65+
#' - `peak_rpm`:
6666
#' - continuous from 4150 to 6600.
67-
#' - `city-mpg`:
67+
#' - `city_mpg`:
6868
#' - continuous from 13 to 49.
69-
#' - `highway-mpg`:
69+
#' - `highway_mpg`:
7070
#' - continuous from 16 to 54.
7171
#' - `price`:
7272
#' - continuous from 5118 to 45400.

data-raw/autoimports_build.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ autoimports = read.csv(url_autoimports,
1010
# Columns taken verbatim from ML page
1111
# Regex search with: [0-9]{1,2}\. (.*):.*
1212
# Replacement: "\1",
13-
colnames(autoimports) = c(
13+
14+
var_names = c(
1415
"symboling",
1516
"normalized-losses",
1617
"make",
@@ -39,6 +40,10 @@ colnames(autoimports) = c(
3940
"price"
4041
)
4142

42-
devtools::use_data(autoimports)
43+
var_names_safe = gsub("-", "_", var_names)
44+
45+
colnames(autoimports) = var_names_safe
46+
47+
devtools::use_data(autoimports, overwrite = TRUE)
4348

4449

data/autoimports.rda

-5 Bytes
Binary file not shown.

man/autoimports.Rd

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

0 commit comments

Comments
 (0)