[R-sig-Geo] spdep: making nb object from csv data
Philip A. Viton
viton.1 at osu.edu
Fri Mar 26 19:42:19 CET 2010
Suppose I have a data frame with a bunch of spatial data
indexed by a region.id, say r_id. I also have a csv file
with spatial neighbors whose format is: row 1 = labels;
column 1 = region id whose order is different from r_id, and
the rest is a square 0/1 indicator matrix of spatial neighbors.
How can I import the csv data into R as an nb object, so
that the order matches the region order in the dataframe?
(I suppose it would be fairly easy to use the data in the csv file
to construct a gal file and then use read.gal;
but I'm hoping there's a more straightforward way).
Thanks!
------------------------
Philip A. Viton
City Planning, Ohio State University
275 West Woodruff Avenue, Columbus OH 43210
viton.1 at osu.edu
More information about the R-sig-Geo
mailing list