[R-sig-Geo] Res: Subsetting shapefile type PolyLine
Roger.Bivand at nhh.no
Mon Feb 4 18:26:18 CET 2008
On Mon, 4 Feb 2008, Rafael Duarte wrote:
> Obrigado Milton.
> teste2[teste2$ELEVATION == 100]
> gives me an empty list. And I have data of Elevation = 100.
> I also tried
> teste2[teste2$ELEVATION >= 100]
> teste2[teste2$ELEVATION == "100"]
> But always an empty list and no plot.
Very close, with:
teste2 <- readShapeLines("bat_lin")
should show ELEVATION - then the help should also work. I think that the
original teste2 would say that its class() was "Map" - for the selection
with [ to work, it should be a SpatialLinesDataFrame.
read.shape is part of the infrastructure, and users are really advised to
move to sp classes, and either readShape*(), or (even better) readOGR() in
the rgdal package, for which you don't need to know in advance what kind
of shapefile you are reading.
Hope this helps,
> Milton Cezar Ribeiro wrote:
>> Hi Rafael
>> i think that it could help you
>> Boa sorte.
>> ----- Mensagem original ----
>> De: Rafael Duarte <rduarte at ipimar.pt>
>> Para: r-sig-geo at stat.math.ethz.ch
>> Enviadas: Segunda-feira, 4 de Fevereiro de 2008 8:23:08
>> Assunto: [R-sig-Geo] Subsetting shapefile type PolyLine
>> Dear all,
>> I am very new to SIG.
>> This is probably a very simple question but I could not find an answer
>> searching the web and the R-SIG emails archive.
>> I have an ESRI shapefile with a coast and bathymetric lines. In the dbf
>> file I have a column ?ELEVATION? that gives this information.
>> I import the shapefile with:
>> teste2 <- read.shape("bat_lin")
>> Shapefile type: PolyLine, (3), # of Shapes: 981
>> Now I plot this information:
>> But my problem is that I want to plot a subset of bathymetric lines:
>> ELEVATION = 100, for example.
>> I tried to follow the example given in maptools: subset.
>> I tried to use functions: Map2lines.
>> But I could not find a solution to plot only a subset of bathymetric
>> Many thanks for any help.
>> Rafael Duarte
>> Marine Resources Department - DRM
>> IPIMAR - National Research Institute for Agriculture and Fisheries
>> Av. Brasília, 1449-006 Lisbon - Portugal
>> Tel:+351 21 302 7000 Fax:+351 21 301 5948
>> e-mail: rduarte at ipimar.pt <mailto:rduarte at ipimar.pt>
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch <mailto:R-sig-Geo at stat.math.ethz.ch>
>> Abra sua conta no Yahoo! Mail
>> o único sem limite de espaço para armazenamento!
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo