One use of ~ is to mention x,y dimensions for plots.
Such as boxplot(y~x, [attr] = [val].....)
Where y, x are fields to plot in y and x-axis.
Some of the functions in R take values as (y,x), that is when ~ is used. In most of the functions (x,y) form is followed.