Re: [R-sig-Geo] difficult to subtract two column of my shapefile

2009-02-24 Thread Robert Hijmans
indeed, on the example file, this works fine. library(foreign) data <- read.dbf('theme1.dbf') data$AminB <- data$A - data$B file.remove('theme1.dbf') write.dbf(data, 'theme1.dbf') if the dbf is too large you could you use a database to import the dbf, add the column, export again. Perhaps sqlite

Re: [R-sig-Geo] difficult to subtract two column of my shapefile

2009-02-24 Thread Jonathan Maynard
Hi, This should work: my_SPDF <- readShapeSpatial("theme1.shp") my_s...@data$ab<-my_s...@data$a-my_spdf@data$B writeSpatialShape(my_SPDF, "mynewfile") Cheers, Jonathan Maynard On Tue, Feb 24, 2009 at 6:37 AM, Alexander Brenning wrote: > Hi there, > > to throw in two more alternatives, there

Re: [R-sig-Geo] difficult to subtract two column of my shapefile

2009-02-24 Thread Alexander Brenning
Hi there, to throw in two more alternatives, there are functions read.dbf and write.dbf in packages shapefiles and foreign (see help files for examples; the functions differ between the two packages despite having the same name). Remember that operations on the shapefile attributes only affe