You are on page 1of 1

~ >save(x,y,z file = "whatever.

Rdata") == save the file

~ >load("whatever.Rdata") == to lod the file

~ >ls() == to list the files in R storage

~ >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

~ install.packages('caTools') == install any package

~ library(caTools) == to load any library

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

You might also like