Skip to content
Prev 5127 / 29559 Next

Help to improve a code to substract two columns, delete and save shape-file

Ale,

Some remarks between the lines:

Alessandro schreef:
Here you extract the data from prova, not including the coordinates. 
Look at class(prova2) to see that it is no longer a 
SpatialPointsDataFrame but a data.frame. Use the following syntax to get 
the data plus the coordinates:

prova2 <- prova["H"]

Now you can export it using write OGR. To get only the values above H == 2:

prova_Hgt2 = prova2[prova2$H > 2,]

Or combining the two actions above into one command:

prova2 = prova[prova$H > 2, "H"]

cheers,
Paul