Hello mates,
I am trying to plot local feature importance (IncMSE) of my random forest model, but I am hitting this error message ‘Error in [.data.frame
(obj@data, zcol) : undefined columns selected’. Surprisingly before updating my RStudio, the code was running.
Here are the codes:
#Plot local feature importance (IncMSE)
col.palette.t<-colorRampPalette(c("blue", "sky blue", "green","yellow","pink", "red"),space="rgb",interpolate = "linear")
DEM<-spplot(gwrf.SPDF,"incMSE.DEM", main = "DEM",
sp.layout=list(state),
col="transparent",
col.regions=rev(col.palette.t(100)))
PopDens<-spplot(gwrf.SPDF,"incMSE.PopDens", main = "PopDens",
sp.layout=list(state),
col="transparent",
col.regions=rev(col.palette.t(100)))
Rainfall<-spplot(gwrf.SPDF,"incMSE.Rainfall", main = "Rainfall",
sp.layout=list(state),
col="transparent",
col.regions=rev(col.palette.t(100)))
NDVI<-spplot(gwrf.SPDF,"incMSE.NDVI", main = "NDVI",
sp.layout=list(state),
col="transparent",
col.regions=rev(col.palette.t(100)))
LST<-spplot(gwrf.SPDF,"incMSE.LST", main = "LST",
sp.layout=list(state),
col="transparent",
col.regions=rev(col.palette.t(100)))
Temp<-spplot(gwrf.SPDF,"incMSE.Temp", main = "Temp",
sp.layout=list(state),
col="transparent",
col.regions=rev(col.palette.t(100)))
RH<-spplot(gwrf.SPDF,"incMSE.RH", main = "RH",
sp.layout=list(state),
col="transparent",
col.regions=rev(col.palette.t(100)))
ET<-spplot(gwrf.SPDF,"incMSE.ET", main = "ET",
sp.layout=list(state),
col="transparent",
col.regions=rev(col.palette.t(100)))
grid.arrange(DEM, PopDens, Rainfall, NDVI, LST, Temp, RH, ET,
ncol=8,
heights = c(30,6),
top = textGrob("Local Feature Importance (IncMSE)",gp=gpar(fontsize=25)))
I need your help. Thank you!