######
##
## Example # 1 - creating a coordinates file for a SaTScan (TM) analysis
##
## This example access the population and case data files used in a
## SaTScan (TM) analysis:
## a) read the files to build a list of all of the location IDs
## involved in the analysis,
## b) validates the location IDs against the U. S. Census web site's
## list of Location IDs for that year and geographic level
## (State, State/County or State/County/Census Tract), and
## c) returns a list of centroid X, Y coordinates for each location ID.
##
## The coordinates file can be written to disk or returned as a data.frame
## to the caller as the return value of the CreateGeo4SS function.
##
## The coordinates values returned are based on an equal-area projection
## of the lat and long values of the area centroids based on the
## area boundary data used to map the areas.
##
## The example population and case data files distributed with the package
## are located in the installation directory for the satscanMapper package.
##
#
## return a DF of the coordination data
#
if (FALSE) {
SSInstDir <- system.file(package="satscanMapper", "extdata")
PopFile <- "inc_noadj_cir.pop"
CasFile <- "inc_noadj_cir.cas"
GeoDF <- CreateGeo4SS(path=SSInstDir,
pop=PopFile,
cas=CasFile,
censusYear="2010",
header=FALSE)
str(GeoDF)
}
# Example removed due to time constraints
#
######
#####
#
# This example #2 creates a coordinates file.
#
if (FALSE) {
SSInstDir <- system.file(package="satscanMapper", "extdata")
PopFile <- "inc_noadj_cir.pop"
CasFile <- "inc_noadj_cir.cas"
GeoDF <- CreateGeo4SS(path=SSInstDir,
pop=PopFile,
cas=CasFile,
geo="inc_noadj_cir.geo",
censusYear="2010",
header=FALSE)
# output file written to the extdata directory of the package installation.
}
####
print(" End of CreateGeo4SS examples.")
####
Run the code above in your browser using DataLab