[R-sig-Geo] Help to improve a code to substract two columns, delete and save shape-file
Alessandro
alessandro.montaghi at unifi.it
Tue Feb 24 20:08:11 CET 2009
Thanks for All help give me.
I spoke with my professor and now I must do some changes. After subtract the
column Z with clomun DEM_SGRD to obtain column H. I wish to create a new
shape with only this H column. I tried and tried but when I write the shape
file there is always an error.
Sorry for all disturb.
I don't want to be ill-mannered, to use improperly your time, but before to
save the shape is It possible to save only all records with H value > of 2.
(the statistical analysis need this clean)
Thanks
Ale
> prova <- readOGR(".", "prova")
OGR data source with driver: ESRI Shapefile
Source: ".", layer: "prova"
with 42 rows and 2 columns
> summary(prova)
Object of class SpatialPointsDataFrame
Coordinates:
min max
coords.x1 267980.1 267998.1
coords.x2 4147799.4 4147818.8
Is projected: NA
proj4string : [NA]
Number of points: 42
Data attributes:
Z DEM_SGRD
Min. :1415 Min. :1412
1st Qu.:1419 1st Qu.:1413
Median :1421 Median :1414
Mean :1423 Mean :1414
3rd Qu.:1424 3rd Qu.:1415
Max. :1437 Max. :1417
> prova$H <- prova$Z - prova$DEM_SGRD
> summary(prova)
Object of class SpatialPointsDataFrame
Coordinates:
min max
coords.x1 267980.1 267998.1
coords.x2 4147799.4 4147818.8
Is projected: NA
proj4string : [NA]
Number of points: 42
Data attributes:
Z DEM_SGRD H
Min. :1415 Min. :1412 Min. : 3.169
1st Qu.:1419 1st Qu.:1413 1st Qu.: 5.612
Median :1421 Median :1414 Median : 7.320
Mean :1423 Mean :1414 Mean : 9.265
3rd Qu.:1424 3rd Qu.:1415 3rd Qu.:10.982
Max. :1437 Max. :1417 Max. :21.806
> prova2 <- prova$H
> summary(prova2)
Min. 1st Qu. Median Mean 3rd Qu. Max.
3.169 5.612 7.320 9.265 10.980 21.810
> writeOGR(prova2, ".", "prova2", driver="ESRI Shapefile")
Errore in writeOGR(prova2, ".", "prova2", driver = "ESRI Shapefile") :
obj of wrong class
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20090224/f52ae7bf/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prova.zip
Type: application/octet-stream
Size: 2204 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20090224/f52ae7bf/attachment.obj>
More information about the R-sig-Geo
mailing list