I have been using this function for a while now. It is weird that all of the sudden the fun=mean is not working for raster package of R!!
rasterize(data_r[,1:2], r, data_r[,3], fun=mean)
Error in .pointsToRaster(x, y, field = field, fun = fun, background = background, :
could not find function "fun"
However, anything other than mean is working; e.g. fun = 'sum' seems to work fine! Any idea?