Loading Shapefile via TERR

Any suggestions to load shapefiles via TERR?  Using rgdal library and the following line of code: WellboreShp <- readOGR(dsn = "P:/Spotfire/RawData/", layer = "WellBore")

WellboreShp is an output parameter (as a table) and the script generates the table - but loses the geometry in the process.  That's part A of my question.  Part B is to then merge the shapefile with another data set so I can then filter out certain rows.  

The merge process works via:  WellboreShp <- merge(WellboreShp,df1, by.x = "UWI", by.y = "UWI")

But, again, I previously lost the geometry so don't have a way to display the feature layer on a map.

Unfortunately, the filter syntax does not work as I receive an error saying it isn't compatible with shapefiles (or something along those lines):

WellboreShp <- filter(WellboreShp,`Hole Direction`=="HORIZONTAL")

Any help is appreciated.

Login