title | permalink | layout | output |
---|---|---|---|
Spatial autocorrelation tutorial |
/about/ |
page |
html_notebook |
This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.
Range of values -Infinitive to + Infinitive Standart deviation is the SQUARE mEASURES Dispersion
#Correlation
library(maptools)
library(spdep)
library(rgdal)
library(spData)
library(GISTools)
The first data set contains census tract data for eight central NY counties:
owd <- getwd()
setwd(system.file("shapes", package="spData"))
NYcounties <- readShapeSpatial("NY8_utm18")
plot(NYcounties)
names(NYcounties)
Let's work on a subset of the map by focusing on Syracuse:
unique(NYcounties$AREANAME)
syracuse <- NYcounties[NYcounties$AREANAME == "Syracuse city",]
plot(syracuse)
coords <- coordinates(syracuse)
par(mfrow=c(1,1))
choropleth(syracuse, syracuse$PCTOWNHOME)
coords <- coordinates(syracuse)
Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).
The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.