25.3 Vector functions

df <- tibble(
  a = rnorm(5),
  b = rnorm(5),
  c = rnorm(5),
  d = rnorm(5),
)

df |> mutate(
  a = (a - min(a, na.rm = TRUE)) / 
    (max(a, na.rm = TRUE) - min(a, na.rm = TRUE)),
  b = (b - min(b, na.rm = TRUE)) / 
    (max(b, na.rm = TRUE) - min(a, na.rm = TRUE)),
  c = (c - min(c, na.rm = TRUE)) / 
    (max(c, na.rm = TRUE) - min(c, na.rm = TRUE)),
  d = (d - min(d, na.rm = TRUE)) / 
    (max(d, na.rm = TRUE) - min(d, na.rm = TRUE)),
)
## # A tibble: 5 × 4
##         a     b     c     d
##     <dbl> <dbl> <dbl> <dbl>
## 1 0.221   0     0.428 0.135
## 2 0.485   1.52  0     0.132
## 3 0.00788 0.473 0.653 0.241
## 4 0       0.629 1     1    
## 5 1       0.142 0.945 0
# Can you spot out the error in the above code?