As we talked about in class, one common way to measure the distance between two numbers \(a\) and \(b\) is to compute

\[ distance = (a-b)^2 \]

For this code challenge, you need to write a function that

Rules:

To win



Solution below…















mean_distance <- function(x,y) {
  distance <- (x-y)^2
  mean(distance)
}

mean_distance(c(10,3,5), c(0.1,3,0))
## [1] 41.00333