I open a shapefile with the rgdal lib:
foo <- readOGR(dsn="myfolder",layer="myshapefileWithoutEnding") foo.df <- as(foo, "data.frame")
Then I add a column to the data frame with
foo.df$MY_VALUE <- myDataFrameWithOneColumn
The I check if it looks fine with print(foo.df) and it does, foo.df shows my values as a new column
Then I write the shapefile
writeOGR(foo, ".", myfilename, driver="ESRI Shapefile")
It saves 4 files, everything looks fine.
But when I open the shapefile in a viewer, I can't see my added column. Everything looks like before.
Any idea why?