~ operator is used in R for performing bivariate or multivariate analysis of variables.
It is used in various functions such as plot, ggplot, kmeans, rpart, etc.
Used as -
LHS~RHS where LHS is analyzed with respect to RHS variables.
tree = rpart(variable~., data = train)
. represents all variables.
Individual variables can also be used by using + operator.