In R, i have run his code
mydata.krig <- krige(Clay~1, train_data, newdata=mask, vgm)
names(mydata.krig) <- "Clay.pred"
min(mydata.krig$Clay.pred, na.rm=T); max(mydata.krig$Clay.pred, na.rm=T) ggplot() +
geom_stars(data = mydata.krig["Clay.pred"]) +
scale_fill_gradient(low = "yellow", high = "dark blue", limits = c(15.5486,61.41131)) +
geom_sf(data = thessaly_smus, color = "black", fill = NA, size = 1) +
labs(title = "%Clay Predicted Values - Ordinary Kriging, OK")
and with the ggplot i have aqcuired a map of the predicted values of %Clay. I want to extract this map as a raster file from R in order to open it in a GIS. Provide me accurate code for this.
From the screenshot you can see, I want the new raster to be the area of interest (polygons) and not the entire picture..
Thanks for the help!