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

Ex:

tree = rpart(variable~., data = train)

. represents all variables.

Individual variables can also be used by using + operator.

For Example,

function(~.annual_inc+home_ownership+term, ...)