'Unexpected symbol in r in decision tree unsolved

I am having a similar issue to Unexpected symbol in rstudio in decision tree but while implementing their solution to my work, I still get the same error:

library(tree)
library(caret)
library(ISLR2)
library(boot)
attach(Carseats)
High=ifelse(Sales <=8, "No", "Yes")
Carseats=data.frame(Carseats, High)
tree.carseats=tree(High∼.-Sales,data=Carseats))

Error: unexpected input in "tree.carseats=tree(High∼"


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source