Please can someone show me how to export a file from R in the format of a shapefile in order to be used in GeosegregationAnalyzer (which requires a shapefile).

I have merged attribute data with the shapefile on R as shown below and want to export this new file called "Classmap01"

Brismap01 = st_read("lsoa01/lsoa01.shp")

Class01 = read.csv("ClassData2001.csv")

Classmaps01 = merge(Brismap01, Class01, by.x="lsoa01cd", by.y="code")

2 Answers 2


Use sf function for layer writing:

st_write(Classmaps01, "Classmaps01.shp")

To export as a .shp use below code:

writeOGR(out.df, dsn = '.', layer = 'poly', driver = "ESRI Shapefile")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.