Skip to content

Instantly share code, notes, and snippets.

@dillonma
Created November 17, 2012 23:18
Show Gist options
  • Save dillonma/4101298 to your computer and use it in GitHub Desktop.
Save dillonma/4101298 to your computer and use it in GitHub Desktop.
Use R with the foreign package to modify the DBF file
library(foreign)
dbfdata <- read.dbf("file.dbf", as.is = TRUE)
## add new attribute data (just the numbers 1 to the number of objects)
dbfdata$new.att <- 1:nrow(shp)
## overwrite the file with this new copy
write.dbf(dbfdata, "file.dbf")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment