# NOT RUN {
# house <- read.table("house.dat", header=FALSE)
# names(house) <- c("price", "yrbuilt", "stories", "TLA", "wall", "beds",
# "baths", "halfbaths", "frontage", "depth", "garage", "garagesqft", "rooms",
# "lotsize", "sdate", "avalue", "long", "lat", "s1993", "s1994", "s1995",
# "s1996", "s1997", "s1998")
# house$syear <- 1992 + house$s1993 + 2*house$s1994 + 3*house$s1995 +
# 4*house$s1996 + 5*house$s1997 + 6*house$s1998
# house$syear <- factor(house$syear)
# house$age <- (1999 - house$yrbuilt)/100
# house$stories <- factor(house$stories, levels=1:7, labels=c("one",
# "bilevel", "multilvl", "one+half", "two", "two+half", "three"))
# house$wall <- factor(house$wall, levels=1:7, labels=c("stucdrvt",
# "ccbtile", "metlvnyl", "brick", "stone", "wood", "partbrk"))
# house$garage <- factor(house$garage, levels=0:4, labels=c("no garage",
# "basement", "attached", "detached", "carport"))
# library(sp)
# coordinates(house) <- c("long", "lat")
# proj4string(house) <- CRS("+proj=longlat +ellps=GRS80")
# library(rgdal)
# house <- spTransform(house, CRS("+init=epsg:2834"))
# library(spdep)
# LO_nb <- graph2nb(soi.graph(tri2nb(coordinates(house)), coordinates(house)))
# W <- as(nb2listw(LO_nb), "CsparseMatrix")
# trMat <- trW(W, type="mult")
# }
# NOT RUN {
data(house)
## maybe str(house) ; plot(house) ...
# }
Run the code above in your browser using DataLab