read.gwt2dist: Read distance ojbects

Description Usage Arguments Details Value Author(s) Examples

View source: R/gwt2dist.R

Description

The function reads "GWT" files (i.e. generated using distance. It will read also other more general formats (as for example .txt files).

Usage

1
read.gwt2dist(file, region.id=NULL, skip=1)

Arguments

file

name of file to be read

region.id

variable that defines the ordering of the observations

skip

skip number of lines

Details

The first line of a 'GWT' file generally contains some information (e.g. the name of the shape file, the number of observations), in which case, skip should be equal to 1. When the file has a 'GWT' extension, the number of observations is generally retrived from the first line. Alternatively, it is fixed to the length of the unique region.id variable.

Value

An object of class distance.

Author(s)

Gianfranco Piras [email protected]

Examples

1
2
3
4
5
6
7
## Not run: 
library(spdep)
data(columbus)
dist<-read.gwt2dist(file=system.file('extdata/knn10columbus.GWT',
 package="sphet"), region.id=columbus$POLYID)

## End(Not run)

sphet documentation built on Jan. 6, 2019, 3:01 a.m.