This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#(so you could modify the relationships as well and create a completely new shapefile) | |
library(rgdal) | |
## read "/path/to/files/filename.shp" | |
shp <- readOGR("/path/to/files/", "filename") | |
## add new attribute data (just the numbers 1 to the number of objects) | |
shp$new.att <- 1:nrow(shp) | |
## write out to a new shapefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am dillonma on github. | |
* I am dillonm (https://keybase.io/dillonm) on keybase. | |
* I have a public key whose fingerprint is 174E 4F3D D478 FAC2 3B61 47CF 7BB9 D96E 021E 0DC0 | |
To claim this, I am signing this object: |