Are you talking about spatial distances? If so sf::st_distance does just that, and it is vectorized, making it easy to calculate distance from a common reference for an entire vector of points. It can even handle point to polygon distance calculation.

set.seed(15)
x=runif(10,1,15) # random x coord
y=runif(10,1,15) # random y coord
x=as.integer(x)
y=as.integer(y)
X=7.5
Y=7.5
store=cbind(X,Y)
onlineloc=cbind(x,y)
plot(x,y,main="Online and instore customer loc",col=" red")
points(X,Y,pch=15)
#' ![](reprex_reprex_files/figure-markdown_strict/reprex-body-1.png)
st_distance(onlineloc,store, by_element = F)
#> Error in st_distance(onlineloc, store, by_element = F): could not find function "st_distance"

set.seed(15)
x=runif(10,1,15) # random x coord
y=runif(10,1,15) # random y coord
x=as.integer(x)
y=as.integer(y)
X=7.5
Y=7.5
store=cbind(X,Y)
onlineloc=cbind(x,y)
plot(x,y,main="Online and instore customer loc",col=" red")
points(X,Y,pch=15)
#'
st_distance(onlineloc,store, by_element = F)
#> Error in st_distance(onlineloc, store, by_element = F): could not find function "st_distance"