Hi, I am a new user of Rstudio. I am trying to calculate distance between points but when I am typing the command I get the following error:

Error: unexpected symbol in "ppDist <- function(pnt1, pnt2){dist <- sqrt((pnt2[1]-pnt1[1])^2 + (pnt2[2]-pnt1[2])^2)unlist"

The command that I give is the following:

ppDist <- function(pnt1, pnt2){dist <- sqrt((pnt2[1]-pnt1[1])^2 + (pnt2[2]-pnt1[2])^2)unlist(dist)}

Can you help me to solve it?

Thanks in advance