Update EOF.R

Apply returns a vector or array or list of values obtained by applying a function to margins of an *array* or *matrix*. So each time we use apply, we have to make sure that it is an array or a matrix. That's why I added `as.matrix()` each time is needed :-)