[R-sig-Geo] RE: [R] adjacency matrix
danlinyu at uwm.edu
danlinyu at uwm.edu
Thu Oct 23 19:42:04 CEST 2003
Hi-
As far as I know, some of the error messages results from the fact that you
either did not install the package or did not load the package.
If you did not install the package, you can install from R's GUI (my
experiences are based on the Windows Version), and load them by type library
(packagename). If you have already installed them, just type library
(packagename) and you will be good to go. For your specific case, after you
started R, just type library(maptools), and you will be able to use all the
functions such as read.shape, Map2poly, plotpolys, etc.
Quoting Orlando Zacarias <si-opz at dsv.su.se>:
>
> Hi once again,
> Now i have been trying to run the R changed example from Maptools package
> manual, and errors occur underlined bellow. It is really troublesome....
> Please assist,
> Orlando.
> ---------------------------------------------------
> shp <- try(library(shapefiles))
> Error in library(maptools) : There is no package called 'shapefiles'
> > if (class(shp) != "try-error") {
> + ShapeDir <- system.file("shapes", package="maptools")[1]
> + try1 <- read.shapefile(paste(ShapeDir, "shapes", sep="/"))
> + shppolys <- shape2poly(try1, as.character(try1$dbf$dbf$NEIGNO))
> + plotpolys(shppolys)
> + title(main="Polygons for Vermani from shapefiles package")
> + }
> >
> > try2 <- read.shape(system.file("shapes/Vermani.shp",
> + package="maptools/man")[1])
> Error: couldn't find function "read.shape"
> > mappolys <- Map2poly(try2, as.character(try2$att.data$NEIGNO))
> Error: couldn't find function "Map2poly"
> > plotpolys(mappolys)
> Error: couldn't find function "plotpolys"
> > title(main="Polygons for Vermani from maptools package")
> Error in title(main = "Polygons for Vermani from maptools package") :
> plot.new has not been called yet
> > if (class(shp) != "try-error") {
> + plotpolys(shppolys)
> + plotpolys(mappolys, add=TRUE, border="red", lty="dotted")
> + title(main="Polygons for Vermani overplotted from both packages")
> + }
> ------------------------------------------------------
More information about the R-sig-Geo
mailing list