Skip to content

Instantly share code, notes, and snippets.

@amkurian
Created February 29, 2020 06:36
Show Gist options
  • Save amkurian/1b981f203757e5519964b74e05d51f76 to your computer and use it in GitHub Desktop.
Save amkurian/1b981f203757e5519964b74e05d51f76 to your computer and use it in GitHub Desktop.
# Encoding categorical data
dataset$Country = factor(dataset$Country,
levels = c('France', 'Spain', 'Germany'),
labels = c(1, 2, 3))
dataset$Purchased = factor(dataset$Purchased,
levels = c('No', 'Yes'),
labels = c(0, 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment