Professional Documents
Culture Documents
R Programming Notes
R Programming Notes
~ >rm(“datastructure1”,…..”datastructuren”)
> rm(list=ls()) == to remove the file
~ datset$xyz = ifelse(is.na(dataset$xyz),
ave(dataset$xyz), FUN = function(x) mean(x, na.rm(TRUE)),
(dataset$xyz) == syntax for averaging the msiing values.
~ datasets$Purchased = factor(datasets$Purchased,
levels = c('Yes', 'No'),
labels = c(1, 0)) == catogorical data encoding
~ set.seed(123)
split <- sample.split(datasets$Purchased, SplitRatio = 0.8) == splitting the
dataset into training and test set
training_set = subset(datasets == TRUE)
test_set = subset(datasets == FALSE)