mirror of
https://github.com/andre-wojtowicz/uci-ml-to-r.git
synced 2024-12-01 16:40:28 +01:00
21 lines
739 B
R
21 lines
739 B
R
|
preprocessDataset = function()
|
||
|
{
|
||
|
csv.file.w = "winequality-white.csv"
|
||
|
csv.file.r = "winequality-red.csv"
|
||
|
|
||
|
dataset.w = read.csv(paste0(orig.dir, "/", csv.file.w), sep=";",
|
||
|
check.names=FALSE)
|
||
|
dataset.w = dataset.w %>% mutate(color="white")
|
||
|
|
||
|
dataset.r = read.csv(paste0(orig.dir, "/", csv.file.r), sep=";",
|
||
|
check.names=FALSE)
|
||
|
dataset.r = dataset.r %>% mutate(color="red")
|
||
|
|
||
|
dataset = rbind(dataset.w, dataset.r) %>%
|
||
|
mutate(color=factor(color),
|
||
|
quality=ifelse(quality>5, 1, 0)) %>%
|
||
|
select(`fixed acidity`:alcohol, color, quality) %>%
|
||
|
mutate(quality=factor(quality))
|
||
|
|
||
|
return(dataset)
|
||
|
}
|