Write a function called error_avg
to observe how much the average can grow with mistakes. This function should take a vector x
containing the values of the Galton data (see code below) and a value k
that will change the first entry to of the vector x
to k
.
library(HistData)
data(Galton)
x <- Galton$child
The function should return the difference in average before and after the addition of the mistake.