How to insert DEM in regression kriging in R

Greetings to all.

I have a DEM shapefile of my area of interest.
How can i insert itin R, and make a regression kriging with the other attribute i study?
e.g i want to make a regression kriging for Clay Soil Attribute and Elevation (dem)

If DEM is an .shp with GIS coordinates, the best way is to import using the {sf} package, which will create a data frame with the coordinates and observations (including elevation, if present) can be added as columns or work with the {elevatr} package.