1
0
mirror of https://github.com/andre-wojtowicz/uci-ml-to-r.git synced 2024-12-23 18:15:30 +01:00
uci-ml-to-r/data-collection/wine-quality/preprocess.R

21 lines
739 B
R
Raw Normal View History

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)
}