This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

library(maptools)
## Loading required package: sp
## Checking rgeos availability: FALSE
##      Note: when rgeos is not available, polygon geometry     computations in maptools depend on gpclib,
##      which has a restricted licence. It is disabled by default;
##      to enable gpclib, type gpclibPermit()
library(rgdal)
## Warning: package 'rgdal' was built under R version 3.1.3
## rgdal: version: 0.9-2, (SVN revision 526)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 1.11.2, released 2015/02/10
## Path to GDAL shared files: C:/Users/Franklin/Documents/R/win-library/3.1/rgdal/gdal
## GDAL does not use iconv for recoding strings.
## Loaded PROJ.4 runtime: Rel. 4.9.1, 04 March 2015, [PJ_VERSION: 491]
## Path to PROJ.4 shared files: C:/Users/Franklin/Documents/R/win-library/3.1/rgdal/proj
library(spatstat)
## Warning: package 'spatstat' was built under R version 3.1.3
## 
## spatstat 1.41-1       (nickname: 'Ides of March') 
## For an introduction to spatstat, type 'beginner'
setwd("C:/GIS_Projects/GIScience_Lab/Project3/point_data")
USshape = readOGR(".","US_simple_dissolve")
## OGR data source with driver: ESRI Shapefile 
## Source: ".", layer: "US_simple_dissolve"
## with 1 features
## It has 1 fields
plot(USshape)

USshape2 =  as(USshape, "SpatialPolygons")
USshape3 = as(USshape2, "owin")
stations = readOGR(".","stations")
## OGR data source with driver: ESRI Shapefile 
## Source: ".", layer: "stations"
## with 1920 features
## It has 11 fields
stations.sp = as(stations, "SpatialPoints")
stations.ppp = as(stations.sp, 'ppp')
stations.ppp$window = USshape3
plot(stations.ppp)

K_stations = Kest(stations.ppp, correction="Ripley")
plot(K_stations)

##      lty col  key                  label
## iso    1   1  iso italic(hat(K)[iso](r))
## theo   2   2 theo     italic(K[pois](r))
##                                           meaning
## iso  Ripley isotropic correction estimate of K(r)
## theo                     theoretical Poisson K(r)

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.