-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread_a_csv.R
More file actions
42 lines (38 loc) · 732 Bytes
/
Copy pathread_a_csv.R
File metadata and controls
42 lines (38 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Load libraries
library(tidyverse)
# Read the csv
df <- read_csv("data/01_automobile_dataset.csv", col_names = F)
# Define the headers
headers <- c(
"symboling",
"normalized-losses",
"make",
"fuel-type",
"aspiration",
"num-of-doors",
"body-style",
"drive-wheels",
"engine-location",
"wheel-base",
"length",
"width",
"height",
"curb-weight",
"engine-type",
"num-of-cylinders",
"engine-size",
"fuel-system",
"bore",
"stroke",
"compression-ratio",
"horsepower",
"peak-rpm",
"city-mpg",
"highway-mpg",
"price"
)
# Add the headers
# colnames(df) <- headers
colnames(df) <- headers
# Save the new csv with headers
write_csv(df, "data/02_automobile_dataset_with_proper_header.csv")