I'm trying to use the hillShade function in the Raster package, and get " could not find function "overlay" " error.
my program reads in a shapefile. Converts it to a raster. uses the terrain function to get the slope, and aspect. Then when it should be creating the hillShade this error happens: "Error in hillShade(fieldSlope, fieldAspect, angle = 45, direction = 180 + : could not find function "overlay""
if there is anything about the hillShade function and overlay on stackoverflow I missed it. So please feel free to point me in the right direction instead.
the program is as follows:
library(rgdal)
library(raster)
setwd("C:/Users/Etching Memories/Documents/Devenshire/Shape/2015/Harvest")
field<-readOGR(".","DEVENSHIRE_Bouge_Big_Harvesting_20151010")
ras<-raster(ncols=40,nrows=40,xmn=min(field$coords.x1),xmx=max(field$coords.x1),ymn= min(field$coords.x2),ymx=max(field$coords.x2))
rasfield<-rasterize(field,ras,field="Elevation",fun=mean)
fieldSlope<-terrain(rasfield,opt="slope")
fieldAspect<-terrain(rasfield,opt="aspect")
hillShade(fieldSlope,fieldAspect,angle=45,direction=180+45)
the compressed shape file is located at: https://www.dropbox.com/s/06pfbusfrxun1fr/bouge%20file.zip?dl=0
Any help is greatly appreciated. Thanks
As Jbaums's said, reinstalling the raster package was what worked and is the correct answer.