Hey. I an having an issue understanding this particular code asked in relation to the specific question below. Specifically the use of "(1)" next to the x. any help in regards to the same would be appriciated.
Q. Write a function called error_avg that takes a value k and returns the average of the vector x after the first entry changed to k. Show the results for k=10000 and k=-10000.
Ans:
x <- Galton$child
error_avg <- function(k){
x[1] <- k
mean(x)
}
error_avg(10000)
error_avg(-10000)