Skip to content

Commit fbc9977

Browse files
authored
Update raw builds (#7)
* Switch from devtools to usethis for `use_data()`. Explicitly set `header` if variable names are present in file. * Re-build Rdas
1 parent 724bc4e commit fbc9977

26 files changed

+42
-36
lines changed

data-raw/abalone_build.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ colnames(abalone) = c("sex",
1616
"rings")
1717

1818
# Save dataset
19-
devtools::use_data(abalone)
19+
usethis::use_data(abalone, overwrite = TRUE)

data-raw/autoimports_build.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ var_names_safe = gsub("-", "_", var_names)
4444

4545
colnames(autoimports) = var_names_safe
4646

47-
devtools::use_data(autoimports, overwrite = TRUE)
47+
usethis::use_data(autoimports, overwrite = TRUE)
48+
4849

4950

data-raw/autompg_build.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ autompg = read.table(
55
"http://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data",
66
quote = "\"",
77
comment.char = "",
8-
stringsAsFactors = FALSE)
8+
stringsAsFactors = FALSE,
9+
header = FALSE)
910

1011
colnames(autompg) = c("mpg", "cylinders", "displacement", "horsepower",
1112
"weight", "acceleration", "model_year", "origin", "car_name")
1213

13-
devtools::use_data(autompg)
14+
usethis::use_data(autompg, overwrite = TRUE)

data-raw/bcw_original_build.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ bcw_original = breast_cancer_wis_data
2828

2929
rm(list="breast_cancer_wis_data")
3030

31-
devtools::use_data(bcw_original, overwrite = TRUE)
31+
usethis::use_data(bcw_original, overwrite = TRUE)

data-raw/bike_sharing_daily_build.R

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,28 @@ download.file("http://archive.ics.uci.edu/ml/machine-learning-databases/00275/Bi
77

88
# Unzip and load bike sharing data into R
99
# Note, data has a header in it!
10-
bike_sharing_daily = read.csv(unz("data-raw/Bike-Sharing-Dataset.zip",
11-
"day.csv"),
12-
colClasses = c("character", # instant
13-
"Date", # dteday
14-
"factor", # season
15-
"factor", # yr
16-
"factor", # mnth
17-
"factor", # holiday
18-
"factor", # weekday
19-
"factor", # workingday
20-
"factor", # weathersit
21-
"numeric", # temp
22-
"numeric", # atemp
23-
"numeric", # hum
24-
"numeric", # windspeed
25-
"integer", # casual
26-
"integer", # registered
27-
"integer" # cnt
28-
)
29-
)
10+
bike_sharing_daily = read.csv(
11+
unz("data-raw/Bike-Sharing-Dataset.zip", "day.csv"),
12+
header = TRUE,
13+
colClasses = c(
14+
"character", # instant
15+
"Date", # dteday
16+
"factor", # season
17+
"factor", # yr
18+
"factor", # mnth
19+
"factor", # holiday
20+
"factor", # weekday
21+
"factor", # workingday
22+
"factor", # weathersit
23+
"numeric", # temp
24+
"numeric", # atemp
25+
"numeric", # hum
26+
"numeric", # windspeed
27+
"integer", # casual
28+
"integer", # registered
29+
"integer" # cnt
30+
)
31+
)
3032

3133
# Improve factor labels
3234
bike_sharing_daily = within(bike_sharing_daily, {
@@ -52,7 +54,7 @@ bike_sharing_daily = within(bike_sharing_daily, {
5254
# })
5355

5456
# Write the bike_sharing_daily dataset
55-
devtools::use_data(bike_sharing_daily, overwrite = TRUE)
57+
usethis::use_data(bike_sharing_daily, overwrite = TRUE)
5658

5759
# Remove the zip + csv after read in.
5860
file.remove("data-raw/Bike-Sharing-Dataset.zip")

data-raw/bridges_build.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ bridges = within(bridges, {
3333
lanes = factor(lanes)
3434
})
3535

36-
devtools::use_data(bridges, overwrite = TRUE)
36+
usethis::use_data(bridges, overwrite = TRUE)
3737

data-raw/car_eval_build.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ colnames(car_eval) = c("buying",
1313
"safety",
1414
"class_value")
1515

16-
devtools::use_data(car_eval, overwrite = TRUE)
16+
usethis::use_data(car_eval, overwrite = TRUE)

data-raw/forest_fires_build.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ url_forest_fires = "https://archive.ics.uci.edu/ml/machine-learning-databases/fo
55

66
forest_fires = read.csv(url_forest_fires, header = TRUE)
77

8-
devtools::use_data(forest_fires, overwrite = TRUE)
8+
usethis::use_data(forest_fires, overwrite = TRUE)

data-raw/glass_build.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ glass = within(glass, {
3636
})
3737

3838
# Save dataset
39-
devtools::use_data(glass, overwrite = TRUE)
39+
usethis::use_data(glass, overwrite = TRUE)

data-raw/hepatitis_build.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
url_hepatitis = "http://archive.ics.uci.edu/ml/machine-learning-databases/hepatitis/hepatitis.data"
55

6-
hepatitis = read.csv(url_hepatitis,
7-
header = FALSE, na.strings = "?")
6+
hepatitis = read.csv(
7+
url_hepatitis,
8+
header = FALSE, na.strings = "?"
9+
)
810

911
# Columns taken verbatim from ML page
1012
# Regex search with: [0-9]{1,2}\. (.*):.*
@@ -46,7 +48,7 @@ hepatitis = within(hepatitis,{
4648
sex = factor(sex, labels = c("Male", "Female"))
4749
})
4850

49-
devtools::use_data(hepatitis, overwrite = TRUE)
51+
usethis::use_data(hepatitis, overwrite = TRUE)
5052

5153
## output colnames
5254
cat(paste0(colnames(hepatitis),"\n"), sep="")

0 commit comments

Comments
 (0)