rspatial-data-frame

How to convert SpatialPointDataFrame to normal dataframe in r?


I could load shp file in r:

setwd("something")
shp = readOGR(dsn = ".", layer = "shp_name")

Now, I want to convert that to a normal dataframe. What should I do?


Solution

  • I found the answer. It's just works like in general:

    shp_df = as.data.frame(shp, xy = T)
    

    You don’t always have to complicate things...