Re: [R] maptools package

2010-11-11 Thread Jon Olav Skoien

On 11/10/2010 11:27 PM, Aleksandr Andreev wrote:

OK, that loads the shape file.

But now when I do:

submap- subset(spb, as.character(spb$Name) == 'Vasilevsky Island')

the submap still has the whole city, not just the subset. Is there now
a different way of extracting a subset from a map?

I have never used subset with shape files, maybe you can try the following?
submap - spb[spb$Name == Vasilevsky Island,]
This usually works if spb is a SpatialPolygonsDataFrame.

Cheers,
Jon


A

2010/11/10 Phil Spectorspec...@stat.berkeley.edu:

Aleksandr -
   What happens when you use

library(maptools)
spb = readShapePoly('/home/sasha/Documents/maps/spb.shp')

- Phil Spector
 Statistical Computing Facility
 Department of Statistics
 UC Berkeley
 spec...@stat.berkeley.edu



On Wed, 10 Nov 2010, Aleksandr Andreev wrote:


A few years back, I wrote some code to plot maps with the maptools
package. Now I am trying to reproduce my results, only to find out
that maptools has been updated and my code no longer works.

I've been able to fix the first part of it by forcing
spb- maptools:::read.shape(/home/sasha/Documents/maps/spb.shp)

(as read.shape has been deprecated)

but now when I do
plot(spb, xlab=Longitude, ylab=Latitude, main=Map of St
Petersburg, Russia)

I get the message
Error in xy.coords(x, y, xlabel, ylabel, log) :
  'x' is a list, but does not have components 'x' and 'y'

What's the new syntax that I'm supposed to use?

I'm using R version 2.12.0 (2010-10-15) on x86_64-pc-linux-gnu (64-bit)

Thanks,


Aleksandr Andreev
Graduate Student - Department of Economics
University of North Carolina at Chapel Hill
Mobile: +1 303 507 93 88
Skype: typiconman

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] maptools package

2010-11-10 Thread Aleksandr Andreev
A few years back, I wrote some code to plot maps with the maptools
package. Now I am trying to reproduce my results, only to find out
that maptools has been updated and my code no longer works.

I've been able to fix the first part of it by forcing
spb - maptools:::read.shape(/home/sasha/Documents/maps/spb.shp)

(as read.shape has been deprecated)

but now when I do
plot(spb, xlab=Longitude, ylab=Latitude, main=Map of St
Petersburg, Russia)

I get the message
Error in xy.coords(x, y, xlabel, ylabel, log) :
  'x' is a list, but does not have components 'x' and 'y'

What's the new syntax that I'm supposed to use?

I'm using R version 2.12.0 (2010-10-15) on x86_64-pc-linux-gnu (64-bit)

Thanks,


Aleksandr Andreev
Graduate Student - Department of Economics
University of North Carolina at Chapel Hill
Mobile: +1 303 507 93 88
Skype: typiconman

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] maptools package

2010-11-10 Thread Jonathan P Daily
I know the default plot() method expects dat$x and dat$y to exist and be 
equal if you simply try

 plot(dat)

Try looking at
 methods(plot)
to see if there is a specified method from maptools,
then check documentation on ?plot.methodfrommaptools

Otherwise, check spb for $x and $y objects.
--
Jonathan P. Daily
Technician - USGS Leetown Science Center
11649 Leetown Road
Kearneysville WV, 25430
(304) 724-4480
Is the room still a room when its empty? Does the room,
 the thing itself have purpose? Or do we, what's the word... imbue it.
 - Jubal Early, Firefly



From:
Aleksandr Andreev aleksandr.andr...@gmail.com
To:
r-help@r-project.org
Date:
11/10/2010 01:10 PM
Subject:
[R] maptools package
Sent by:
r-help-boun...@r-project.org



A few years back, I wrote some code to plot maps with the maptools
package. Now I am trying to reproduce my results, only to find out
that maptools has been updated and my code no longer works.

I've been able to fix the first part of it by forcing
spb - maptools:::read.shape(/home/sasha/Documents/maps/spb.shp)

(as read.shape has been deprecated)

but now when I do
plot(spb, xlab=Longitude, ylab=Latitude, main=Map of St
Petersburg, Russia)

I get the message
Error in xy.coords(x, y, xlabel, ylabel, log) :
  'x' is a list, but does not have components 'x' and 'y'

What's the new syntax that I'm supposed to use?

I'm using R version 2.12.0 (2010-10-15) on x86_64-pc-linux-gnu (64-bit)

Thanks,


Aleksandr Andreev
Graduate Student - Department of Economics
University of North Carolina at Chapel Hill
Mobile: +1 303 507 93 88
Skype: typiconman

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] maptools package

2010-11-10 Thread Phil Spector

Aleksandr -
   What happens when you use

library(maptools)
spb = readShapePoly('/home/sasha/Documents/maps/spb.shp')

- Phil Spector
 Statistical Computing Facility
 Department of Statistics
 UC Berkeley
 spec...@stat.berkeley.edu



On Wed, 10 Nov 2010, Aleksandr Andreev wrote:


A few years back, I wrote some code to plot maps with the maptools
package. Now I am trying to reproduce my results, only to find out
that maptools has been updated and my code no longer works.

I've been able to fix the first part of it by forcing
spb - maptools:::read.shape(/home/sasha/Documents/maps/spb.shp)

(as read.shape has been deprecated)

but now when I do
plot(spb, xlab=Longitude, ylab=Latitude, main=Map of St
Petersburg, Russia)

I get the message
Error in xy.coords(x, y, xlabel, ylabel, log) :
 'x' is a list, but does not have components 'x' and 'y'

What's the new syntax that I'm supposed to use?

I'm using R version 2.12.0 (2010-10-15) on x86_64-pc-linux-gnu (64-bit)

Thanks,


Aleksandr Andreev
Graduate Student - Department of Economics
University of North Carolina at Chapel Hill
Mobile: +1 303 507 93 88
Skype: typiconman

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] maptools package

2010-11-10 Thread Aleksandr Andreev
OK, that loads the shape file.

But now when I do:

submap - subset(spb, as.character(spb$Name) == 'Vasilevsky Island')

the submap still has the whole city, not just the subset. Is there now
a different way of extracting a subset from a map?

A

2010/11/10 Phil Spector spec...@stat.berkeley.edu:
 Aleksandr -
   What happens when you use

 library(maptools)
 spb = readShapePoly('/home/sasha/Documents/maps/spb.shp')

                                        - Phil Spector
                                         Statistical Computing Facility
                                         Department of Statistics
                                         UC Berkeley
                                         spec...@stat.berkeley.edu



 On Wed, 10 Nov 2010, Aleksandr Andreev wrote:

 A few years back, I wrote some code to plot maps with the maptools
 package. Now I am trying to reproduce my results, only to find out
 that maptools has been updated and my code no longer works.

 I've been able to fix the first part of it by forcing
 spb - maptools:::read.shape(/home/sasha/Documents/maps/spb.shp)

 (as read.shape has been deprecated)

 but now when I do
 plot(spb, xlab=Longitude, ylab=Latitude, main=Map of St
 Petersburg, Russia)

 I get the message
 Error in xy.coords(x, y, xlabel, ylabel, log) :
  'x' is a list, but does not have components 'x' and 'y'

 What's the new syntax that I'm supposed to use?

 I'm using R version 2.12.0 (2010-10-15) on x86_64-pc-linux-gnu (64-bit)

 Thanks,

 
 Aleksandr Andreev
 Graduate Student - Department of Economics
 University of North Carolina at Chapel Hill
 Mobile: +1 303 507 93 88
 Skype: typiconman

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.