spatial classification clustering

I'd agree with @jlacko's suggestion of trying to move to the sf package, from experience it will improve your workflow.

However, I think your problem is related to the clustering bit. What variables are in tablevariable and classes? Take a look at names(DF) and head(DF), substituting each of tablevariables[,1:5] and classes for DF. I suspect there are no variables called x and y, but in the absence of a reprex, we're a bit in the dark here.

Note that, using clustering does not mean you can't work with the sf package, you could create an sf object from classes, see ?st_to_sf before adding it to your map with geom_sf.

Ron.