as.data.frame(your_sf_object)[,-ncol(your_sf_object)]
returns all the attribute columns except for its geometry. Also, use as.data.frame(your_sf_object)[,-8]
if your 8th column is geometry.
If you prefer to use data.table rather than data.frame, you can use
data.table(your_sf_object)[,-ncol(your_sf_object),with=F]
or data.table(your_sf_object)[,-8,with=F]
if your 8th column is geometry.
NOTE: This is my answer to an already old question, but time will come when I need this solution again but I forgot how I did it, so this is a good place to store the solution. Anyway, I got this solution from this thread. Sincerely, Yours Truly...
df <- st_drop_geometry(df)
0.7-2
on cran. And it's here rdocumentation.org/packages/sf/versions/0.7-2/topics/…