SeerMapper: Quick Data Mapper at State, Health Service Areas,...

Description Usage Arguments Details Value Author(s) Examples

View source: R/SeerMapper.R

Description

Provides a easy and quick means of creating U.S. maps of rates or data at the U.S. State, Health Service Areas (HSA), State/County, State/County/Census Tract or U.S. Seer Registry area levels. Send data is provide at the state level, the outlines of all states are overlaid, but only the states with data are categorized and colored. If the data is provided at the HSA, state/county or state/county/census tract level, only the states involved are outlined and only the registry areas with data are categorized and mapped. If the data is provided at the Seer Registry area level, all of the states are outlined, but only the Seer Registry areas with data are categorized and mapped. Each row in the statistics data.frame represents one area (a state, state/county, state/county/census tract, or Seer registry area.) Either the U.S. FIPS code, the HSA number or the Seer Registry area abbreviation is used to tie the data with the associated geographic area boundary for mapping. The package supports mapping with either the 2000 or 2010 U. S. Census Bureau boundaries at the state (district, territory), HSA, and county levels using a modified version of the census boundary data. The package also supports mapping of the NCI Seer Registries and/or counties or census tracts within the Seer Registries. The SeerMapper function and all of the supporting boundary data and information, even when compressed, could not fit within CRAN's 5 megabyte package size limitation. Therefore, the package and the boundary information for the 2000 and 2010 census tracts are distributed as a set six (6) boundary dataset data only packages; the SeerMapperRegs, SeerMapperEast and SeerMapperWest packages provide the 2000 census tract boundaries and the SeerMapper2010Regs, SeerMapper2010East and SeerMapper2010West packages provide the 2010 census tract boundaries. When SeerMapper is installed, its dependencies on the other six (6) packages will automatically installs them. When SeerMapper is called and census tract boundaries are required for a specific census year and area, the package ensures the appropriate supplement packages are loaded and the census tract boundary data and information are available. The caller does not have to install or load the six(6) packages. SeerMapper handles management of these extra packages. All of the boundary data and information is intended for mapping purposes and should not be used for locating geographical points or area estimating. The boundary data has been simplified to speed up the mapping process and reduce the size of the boundary distributed with the package. The purpose of this package is to be fully self-contained and provide quick and easy method of generating maps from data. The boundary data and information used by the package is distributed amoung the packages as follows:

  1. main package - Code and all state, regional, Seer Registry, HSA, and county boundaries for census years 2000 and 2010.

  2. Census Year 2000 census tracts boundary packages

    1. SeerMapperRegs -the census tract boundaries for 19 states containing Seer Registries (Regs);

    2. SeerMapperEast -the census tract boundaries for 20 states not containing Seer Registries east of the Mississippi river and DC and Puerto Rico;

    3. SeerMapperWest -the census tract boundaries for 13 states not containing Seer Registries west of the Mississippi river;

  3. Census Year 2010 census tracts boundary packages

    1. SeerMapper2010Regs -the census tract boundaries for 19 states containing Seer Registries (Regs);

    2. SeerMapper2010East -the census tract boundaries for 20 states not containing Seer Registries east of the Mississippi river and DC and Puerto Rico;

    3. SeerMapper2010West -the census tract boundaries for 13 states not containing Seer Registries west of the Mississippi river;

These packages are automatically installed when SeerMapper is installed and are loaded as required by SeerMapper.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
SeerMapper( ndf,                                  
	censusYear     = NULL,    # default: 2000 census
	proj4          = NULL,    # default: NULL - no transformation, original boundary
	                          #                 projection is used to draw maps.
	idCol          = NULL,    # default: "FIPS"
	dataCol        = NULL,    # default: "Rate"
	categ          = NULL,    # default, "5" 
	mTitle         = NULL,    
	mTitle.cex     = NULL,    # default: 1
	us48Only       = NULL,    # default: TRUE
	includePR      = NULL,    # default: FALSE
	regionB        = NULL,    # default: "NONE" *
	stateB         = NULL,    # default: "NONE" *
	seerB          = NULL,    # default: "NONE" *
	hsaB           = NULL,    # default: "NONE" *
	countyB        = NULL,    # default: "NONE" *
	tractB         = NULL,    # default: "NONE" *
	dataBCol       = NULL,    # default: 'black'
	fillTo         = NULL,    # default: "NONE"
	clipTo         = NULL,    # default: "NONE"
	hatch          = NULL,    # T/F or List of hatching options
	hatch2         = NULL,    # default: NULL (empty)
	mLegend        = NULL,    # T/F or list of legend options.
	brkPtDigits    = NULL,    # default: 2
	palColors      = NULL,    # default: "RdYlBu" w/11 cat. colors
	debug          = NULL     # default: FALSE
	)	
	

Arguments

ndf

a data.frame containing identifier, data and pValue for each area to map. The ndf must contain the id and data column providing the geographical link to the boundary data and the data to be classified and colored by the package. See the idCol and dataCol parameters below for more details. Based on the type of area identifer used, the package can produces maps at the state, state/county, state/county/census tract, Seer Registry area, state/seer/county or state/seer/county/tract levels.

censusYear

is a numeric or character value of the the census year boundary data to use in the validation of the data and mapping of the areas. The value must be 2000 or 2010. The default is 2000 in the SeerMapper call. Using the SeerMapper2010 function call, the censusYear call parameter is set to "2010".

proj4

is a character vector specifying the proj4 parameters for the projection transformation of the map and hatching prior to drawning. By default the map projection is
CRS("+proj=aea +lat_1=33 +lat_2=49 +lat_0=39 +lon_0=96W +ellps=WGS84")
The proj4 parameter would be set as follows:
proj4 = "+proj=utm +zone=15"

idCol

a character vector specifying the name of the column in the ndf data.frame to use for the rate data to categorize and mapped. The default value is FIPS.

dataCol

a character vector specifying the name of the column in the ndf data.frame to use for the rate data to categorize and mapped. The default value is Rate. If categ is set to "data", then the dataCol column contains the integer category numbers instead of rates.

categ

a chacacter or numeric vector specifying a single numeric value (the number of calculated categories), a numeric vector of multiple values (to be used as the breakpoints in the data categorization), "data", or "colors".

         categ=5
           - or - 
         categ=c(0.6, 0.8, 1.0, 1.2, 1.4)
           - or - 
         categ="data" or "colors"
    

The default value is 5. This default allows mapping of any range of data quickly. If more categories or specific categories are then required, the categ parameter can be used to adjust the categorization.

When the number of categories is specified as a single value, the number of categories must be an integer and within the range of 3 to 11 and less than or equal the maximum number of categories supported by the color palette selected with the palColors parameter. For example: categ = 5. (See the palColors section for more detail.)

When the actual break points are provided, the vector must have between 3 and the maximum number of categories supported by the color palette MINUS one. For example, if palColors="Spectral", the maximum number of categories is 11. Therefore, the maximum number of breakpoints that can be provided in the categ list is 10. For example: categ = c(0.6, 0.8, 1.0, 1.2, 1.4).

If any map has the same color for all areas with data and a breakpoint list is used, check the range of the data and the breakpoint list to determine why all of the area were categorized into the same color.

If multiple maps of data need to be compared, it is recommended, the same breakpoint list be used for all package call to ensure the categories and coloring are the same on each map.

When the categ parameter is set to data or colors, the data in the first parameter data.frame is not categorized.
When set to data, the data is treated as the sub-area's category value. The value must be a positive integer value and should in range from 1 to "n". The lowest value does not have to be 1, but the range of values should be < 11 to produce effective maps. The first color is assigned to the lowest value. Additional colors are assigned to each additional integer (+1) up to 11 colors. In this way the range of categories is used to determine the number of colors required. The palette specified in palColors limits the number of category values the caller can specify. For example: for palColors="Spectral" the data value range is limited to 11 values, such as c(1:11) or c(5:16). It is recommended the first category value should always be 1.
When set to colors, the data is treated at the color the sub-area will be filled with. The data values are validated to make sure they represent valid color names or "#hhhhhh" values. If a color name is used, it must match a name created by the color() function. If a color hex value is used, it must in the form of "#rrggbb" or "#rrggbbaa" where each digit is a digits (0-F) for the "r"ed, "g"reen, "b"lue and "a"lpha values of the color. See the rgb and col2rgb functions for more details.

mTitle

A character vector with one or two character strings to be used as the title of the map. For example: mTitle=c("Major Title Line","minor title line")

mTitle.cex

A numeric specifying the size of the title lines.

us48Only

a logical value. If TRUE, only the contiguous 48 states and DC are mapped. Alaska, Hawaii and Puerto Rice are not mapped and any data for sub-areas in these states are ignored. This also includes data for Seer Registries in Alaska and/or Hawaii. If data for the Hawaii registry is being mapped, make sure to use the default or set us48Only to FALSE. If FALSE, All 51 states and DC are mapped. PR can optionally be included is includePR is set to TRUE. The default value is FALSE.

includePR

a logical value. If set to TRUE and US48Only = FALSE, Puerto Rico is mapped with the rest of the states and DC. If set to FALSE, Puerto Rico is not mapped. The default value is FALSE.

regionB

Regional Boundary Option. This option has three values: NONE, DATA, and ALL. The default value is NONE. When set to NONE, no regional boundaries are mapped.
When set to DATA, regional boundaries drawn when a region contains a state, county or tract with data.
When set to varALL, all regional boundaries are drawn.
The regions are the 4 U. S. census regions of NorthEast, South, West, and MidWest.

stateB

State Boundary Option. This option has four values: NONE, DATA, REGION, and ALL. The default value is DATA with state data and NONE for all other levels of data. When set to ALL, all state boundaries are mapped.
When set to REGION, all states within a region are drawn when the region contains a sub-area with data.
When set to DATA, only the state boundaries are drawn if the state or a sub-area has data values.
When set to NONE, None of the state boundaries are drawn.

seerB

Seer Registry Area Boundaries Option. This option has five values: NONE, DATA, STATE, REGION, and ALL. The default value is DATA with Seer Registry data and NONE for all other levels of data.
When set to ALL, all registry boundaries are drawn.
When set to REGION, all registry boundaries are drawn within a region when the region contains a state, registry or sub-area with data.
When set to STATE, all registry boundaries within a state are drawn when the state contains sub-areas with data.
When set to DATA, only registry boundaries are drawn if the registry contains areas with data values.
When set to NONE, no registry boundaries are drawn.

hsaB

Health Service Area Boundary Option. This option has four values: NONE, DATA, SEER, and STATE. The default value is DATA with HSA data and NONE for all other levels of data.
When set to STATE, all HSA boundaries within a state are drawn if the state contains sub-areas with data.
When set to SEER, all HSA boundaries within a Seer Registry are drawn if the state contains sub-areas with data.
When set to DATA, only the HSA boundaries are drawn if the HSA or a sub-area in it has data.
When set to NONE, None of the HSA boundaries are drawn.

countyB

County Boundaries Option. This option has five values: NONE, DATA, HSA, SEER, and STATE. This option is only valid when county or census tract level data is used. The default value is DATA with county level data and NONE for all other levels of data.
When set to NONE, No county boundaries are drawn.
When set to DATA, Only county boundaries are drawn, if the county has data or contains a tract with data values.
When set to HSA, All county boundaries are drawn within a HSA, if the HSA contains any county or tract with data values.
When set to SEER, All county boundaries are drawn within the Seer Registry, if the registry contains any county or tract with data values.
When set to STATE, All county boundaries are drawn within a state, when the state contains any county or tract with data.

tractB

Census Tract Boundaries Option. This option has six values: NONE, DATA, COUNTY, HSA, SEER, and STATE. This option is only valid with census tract level data. The default value is DATA for tract level data and NONE for all other levels of data.
When set to NONE, No tract borders are drawn.
When set to DATA, All tract boundaries are drawn for tracts with data values.
When set to COUNTY, All tract boundaries are drawn for tracts within a county, if the county contains any tract with data values.
When set to HSA, All tract boundaries are drawn within a HSA, if the HSA contains any tract with data values.
When set to SEER, All tract boundaries are drawn for tracts within a registry, if the registry contains any tract with data values.
When set to STATE, All tracts boundaries are drawn for trats within a state, if the state contains any tract with data values

fillTo

This parameter has been replaced by the full implementation of the stateB, seerB, countyB, and tractB call parameters. Parameter is obsolete.

clipTo

a character or logical value. This parameter controls how the map will be drawn in the in the grapics area and how the spatial box is calculated. The values for clipTo are: TRUE, FALSE, "NONE", "DATA", "SEER", or "STATE". If clipTo is set to FALSE or "NONE", the graphics box is set to cover all of the requested boundaries. So, if all of the state boundaries were requested and only one state has data, the entire U.S. will be mapped. If clipTo is set to TRUE or "DATA", the data sub-areas as would occur is all boundary controls were set to "NONE" and the level of the data set to "DATA". (e.g., for county data, stateB="NONE", seerB="NONE", and countyB="DATA". If additional boundaries are requested the extend beyond the data sub-areas, they will be clipped at the graphic edges. If clipTo is TRUE or "DATA", the spatial box is set to cover then the graphics is clipped to the spatial box that contains the data areas being mapped. Any boundaries extending beyond the data area would be clipped at the edge of the graphic space. If clipTo is "SEER" and the data is in Seer Registries, then the boundary of the Registries is used as the graphics box. If the clipTo is "STATE", then the state or states containing the data sub-areas are used as the graphics box for the mapping.

dataBCol

is a character vector of one element. It is used to specify the color of the data level boundary on the maps. The default value is 'black'. The value must be a color name from the colors() name list or a string starting with a "#" with 6 or 8 hexidecimal digits representing the RGB and transparancy values of a color. If the color specified is not valid, the function will generate a warning and stop.

mLegend

is a list of legend options. It must a list containing named items. The mLegend can be disabled by setting mLegend = NA is the call. The legend is placed on the bottom of the map. The following options are available to fine tune the map's legend: counts, size, numberColumns, pos, and noValue. See below for more details on each option. The options are specified in the call by setting mLegend = list(counts=TRUE, size=0.6), for example.

numCols

is the number of columns to use when creating a legend. The default is 3. The number of columns can range from 1 to 8. (Old name: legendColn and ncol)

size

is a numeric value used to size the legend symbols and texts as required. The default value is 0.85. (Old name: legendCex)

pos

is a character vector specifying the location of the legend along the bottom of the map. The acceptable values are left, center, and right. The default is left. (Old name: legendPos)

counts

is a logical variable - TRUE or FALSE. If TRUE, the observation counts for each category are displayed in the legend after the description text. The default is FALSE. (Old name: legendCnt)

noValue

is a logical variable - TRUE or FALSE. If TRUE, any category containing no observations (data) is tagged in the legend with "NV" after the category label. The default is FALSE.

hatch

is a logical value of TRUE or FALSE or a list structure with hatching settings. The call parameter enabled and provided parameters for hatching areas (state, Seer Registry, county or census tracts) based on data and a criteria. The most common use of hatching is to indicate the reliability of the data via a P-Value. In this case, the range of the data is 0 to 1, the comparison value is 0.05 and the criteria is greater than to hatch an area. If the hatch parameter is set to TRUE, then hatching will be implemented using the standard settings for hatching. The standard settings are: range = 0 to 1, value = 0.5, ops = gt, and dataCol = pValue. If set to FALSE, no hatching is done. If the hatch call parmeter is set to a list, hatching is enabled and the list is inspected for overriding values for the default setting. If two hatching patterns are required, the hatch2 call parameter can be used to specify a second data column, operator and test valid. (see below).

The following hatch settings may be changed using the hatch call parameter to pass a list of items and new values. The acceptable set of items are:

dataCol

a character vector specifying the name of the column in the ndf data.frame to use to test the P_Value for each area. The value in this column used to test if the P_Value is < 0.05. If the value is not < 0.05, then the associated area is hatched as an indicator. The default column name value is pValue. Please note the same variable name is used as the statistical data, but this variable is used for the hatching feature.

ops

a character value. The values may be one of the following: "eq", "ne", "lt", "le", "gt", or "ge". These translate to "==", "!=", "<", "<=", ">", and ">=" operations. Other notations are allowed and translated appropriately: "<>", "=>", "=", and "=<". The comparison is the data in the dataCol column to the hatch value option using the ops operation.

The formula is dataCol ops value.

For example, for P-Value testing the test is data > 0.05. A TRUE result will cause the area to be hatched.

value

a numeric break point for comparison with the hatching data column (pValue). Default is 0.05.

range

a vector of two values, min and max inclusively. Range checking of is normally disabled, but can be used to validate the data used to determine if hatching should be done for an area. range can be set to: NA, FALSE to disable range checking, TRUE to enable range check for varc(0,1), or to a range checking vector of a low and high value, c(1234,532). If the low and high value of the range is out of order, it will be sorted and a warning message generated. If the range of the hatching data is not know, it is recommended to disable the range checking. If the data is pValue data, then range=TRUE will ensure all of the data is valid.

lab

a character vector containing a label for this hatching activity. The default is "hatch#1".

col

a character vector containing the name or #A8A8A8 value of the color to be used for the area hatching pattern. The default value is grey(0.66) or #A8A8A8.

lwd

a numeric value. The line weight for the hatching lines. Default value is 0.5.

density

a numeric value. density or den can also be used as the option name. When drawing the hatching over the area, this option specifies the density of the hatching pattern in lines per inch. The valid range is from 5 to 64 lines per inch. The default value is 25.

angle

a numeric value. When drawing the hatching over the area, this option specifies the angle of the hatching pattern in degrees counter clockwise. The default value is 45 degree. The value must be between 360 and -360 degrees.

incAngle

a numeric value. When drawing multiple hatching lines, this option specifies the increment the angle will be increased for subsequent hatching. The default value is 60 degree. The value must be between 360 and -360 degrees.

hatch2

is used to specify the options for a second hatching overlay on the maps. If the hatch2 parameter is set a list of options, then the hatching is enabled. This list only contains the location of the data (dataCol), the operator (ops), the test value (value) and the range test (range) is needed. All other hatching options are taken from the hatch defaults or option values.

The most common use of hatching is to indicate the reliability of the data via a P-Value. The hatch2 parameter uses the same defaults as hatch. The standard options and settings are: range = 0 to 1, value = 0.5, and ops = gt. The dataCol must be defined to enable hatch2.

The acceptable set of options are:

dataCol

a character vector specifying the name of the column in the ndf data.frame containing the values for each sub-area to use in the hatching test. This option must be specified to enable the second hatching feature. The default column name value is NJLL.

ops

a character value. The value may be one of the following: "eq", "ne", "lt", "le", "gt", or "ge". These translate to "==", "!=", "<", "<=", ">", and ">=" operations. Other notations are allowed and translated appropriately: "<>", "=>", "=", and "=<". The comparison is the data pointed to by dataCol column name using the ops operater to the value test value.

The formula is dataCol ops value.

For example, for P-Value testing the test is data > 0.05. A TRUE result will cause the area to be hatched.

value

a numeric test value for comparison with the hatch2 data column (dataCol) provided by the caller. Default is 0.05.

range

a vector of two values, min and max inclusively. Range checking of is normally disabled, but can be used to validate the hatch2 data for the sub-areas. range can be set to: NA or FALSE to disable range checking, TRUE to enable range check for varc(0,1), or to a range checking vector of a low and high value, c(1234,532). If the low and high value of the range is out of order, they will be sorted and a warning message generated. If the range of the hatching data is not know, it is recommended to disable the range checking.

lab

a character vector containing a label for this hatching activity. The default is "hatch#2".

brkPtDigits

specifies the number of digits to the right of the decimal place when calculating or pre-processing the break point list and resulting categorization intervals. Default is the calculated number of digits based on the interval between break points. For example: if brkPtDigits = 1, the breakpoint rounded and limited to only having one digit. The valid range is 1 to 4. The default value is 2. This parameter is only active when the categ call parameter specifies the number of categories.

palColors

a character string specifying the RColorBrewer color palette used to generate the colors to map the data categorization. The specified palette is check for validity and the maximum number of colors for the palette is used to limit the number of categories the user can specify in categ parameter. See the RColorBrewer help for a list of the acceptable color palettes. This call parameter is only active when the categ is NOT set to "COLORS".

The permitted color palettes and maximum number of colors (categories) supported are:

Type of Palette Palette Name Maximum
Sequential Blues 9
Sequential BuGn 9
Sequential BuPu 9
Sequential GnBu 9
Sequential Greens 9
Sequential Greys 9
Sequential Oranges 9
Sequential OrRd 9
Sequential PuBu 9
Sequential PuBuGn 9
Sequential PuRd 9
Sequential Purples 9
Sequential RdPu 9
Sequential Reds 9
Sequential YlGn 9
Sequential YlGnBu 9
Sequential YlOrBr 9
Sequential YlOrRd 9
Diverging BrBG 11
Diverging PiYG 11
Diverging PRGn 11
Diverging PuOr 11
Diverging RdBu 11
Diverging RdGy 11
Diverging RdYlBu 11
Diverging RdYlGn 11
Diverging Spectral 11
Qualitative Accent 8
Qualitative Dark2 8
Qualitative Paired 12
Qualitative Pastel1 9
Qualitative Pastel2 8
Qualitative Set1 9
Qualitative Set2 8
Qualitative Set3 12

All palettes have minimum number of colors (categories) of 3. For more details on each palette and their characteristics visit the http://www.colorbrewer.org website. The actual parameter testing of the palette names and maximum number of colors for each palettes is based on the brewer.pal.info data.frame provided by RColorBrewer package. It is strongly recommended the users stay with color schemes in the diverging group.

debug

is a logical variable. When set to TRUE, debug prints of variables and the flow of the package are enabled. Use of this option adds a large number of debug lines to the package standard device output.

Details

The SeerMapper package (and the SeerMapper2000 and SeerMapper2010 functions) provide a simple means of mapping data for the U. S. at several levels: State, State/County, State/County/Census Tract, and U. S. Seer Registry areas. The package automatically determines the mapping level based on the data and the area identifiers provide at the time of the call. The data is categorised and each area is drawn and colored appropriately based on its data value.

The censusYear call parameter controls which census year name tables and boundary data will be used for the mapping. The SeerMapper2000 function overrides the censusYear parameter and sets it to "2000" for the 2000 U. S. census. The SeerMapper2010 function sets the censusYear parameter to "2010" for mapping with the 2010 U. S. location FIPS codes. The default value for the censusYear parameter is "2000", so calling SeerMapper without the censusYear parameter set, is equivalently the same as calling SeerMapper2000.

The level of the map is determined by the identifier used in the data provided when the function is called.

If the data uses the U. S. State fips code (2 digits) as the spatial identifer, then the state boundaries are drawn and colored. In this mode, the caller has two options: draw all of the states in the US (or continental 48 state), drawn only the states with data. This is controled by the stateB call parameter. It's default value for state level data is ALL. To only draw boundaries for states with data, specify stateB = DATA. Seer Registry, county and census tract boundaries will not be drawn.

If the data uses the U. S. State and County fips code (5 digits) as the spatial identifier, then the state and county boundaries are drawn and colored for areas with data. In this mode, there are several options:

a) Draw only the boundaries for the counties with data ( countyB = DATA ), b) Draw the counties with data and their state's boundaries (states with data) ( stateB = DATA ), c) Draw the boundaries for all of the counties in the states where data was provided for any county in the state (state with data and counties within the state) ( stateB = DATA and countyB = STATE ), d) Draw the bountaries of all of the counties within a Seer Registry where data was provided for any county in the Seer Registry (Seer Registry with data) ( countyB = SEER ),

If the data uses the U. S. State, County and Census Tract fips code (11 digits) as the spatial identifier, then the census tracts boundaries are drawn and colored for areas with data. In this mode, there are several options:

a) Draw only the boundaries for the census tracts with data ( tractB = DATA default setting), b) Draw the tracts with data and their state's boundaries (states with data) ( stateB = DATA ), c) Draw the boundaries for all of the tracts in the states where data was provided for any tract in the state (state with data and tracts within the state) ( stateB = DATA and tractB = STATE ), d) Draw the bountaries of all of the tracts within a Seer Registry where data was provided for any county in the Seer Registry (Seer Registry with data) ( tractB = SEER ),

If the spatial identifier does not match one of the above patterns, the package attempts to match the identifier against the list of Seer Registry abbreviations and an partial match against keywords for the Seer Registries. If there is no match, an error message is generated to inform the caller. When Seer Registry data is used, the package maps each Seer Registry based on the data presented.

In this mode, there are several options:

a) Draw only the boundaries for the Seer Registries with data without any state boundaries ( seerB = DATA and stateB = NONE, the default setting ), b) Draw only the boundaries for the Seer Registries with data and their associated state boundaries ( seerB = DATA and stateB = DATA ), c) Draw only the boundaries for the Seer Registries with data and all of the U.S. state boundaries ( seerB = DATA and stateB = ALL ), d) Draw all of the Seer Registries boundaries within a state with data and only the state boundaries with data ( seerB = STATE and stateB = DATA ).

For each level of data, there are more options related to how and when the state, county, census tract and Seer Registry are drawn. See the descriptions for the stateB, seerB, countyB, and tractB call parameters.

The fips codes used to idenfity an area, but all be the same in the data; for states data, the 2 digit code, for state/countiesdata, the 5 digit code consisting of the 2 digit state and 3 digit county codes, for state/county/tract data, the 11 digit fips code consisting of the 2 digit state code, 3 digit county code, and the 6 digit census tract code.

For Seer Registry mapping, the identifier must be the Seer Registry abbreviate or a character string the uniquely partically matches one and only one alias string for the Seer Registry. The acceptable abbreviations and partial matches are:

Seer Registry Abbr Seer Registry Alias Description
AK-NAT ALASKA Alaska Native Registry
AZ-NAT ARIZONA Arizona Native Registry
CA-LA LOS ANGELES Los Angeles CA Registry
CA-OTH CALIFORNIA EXCL California Registry all county not in other CA registries
CA-OTH GREATER CALIF See Above
CA-SF SAN FRAN California San Fran/Oakland
CA-SJ SAN JOSE California San Jose/Monteray
CT CONNECTICUT State of CT Registry
GA-ATL ATLANTA Atlanta GA metro
GA-OTH GEORGIA OTHER All counties no in the Altanta or Rural registries
GA-OTH GREATER GEOR See above
GA-RUR RURAL GEORG Rural GA counties Registry
HI HAWAII State of HI Registry
IA IOWA State of Iowa Registry
KY KENTUCKY State of Kentucky Registry
LA LOUISIANA State of Louisiana Registry
MI-DET DETROIT Detroit Metro Registry
NJ NEW JERSEY State of NJ Registry
NM NEW MEXICO State of NM Registry
OK-CHE CHEROKEE Oklahoma Cherokee Nationn Registry
UT UTAH State of Utah Registry
WA-SEA PUGET Seattle/Puget Sound Registry
WA-SEA SEATTLE See Above

To be able to handle data from different sources, there may be multiple alias lines in the above table.

The package depends on the following other third party R packages for functionality: graphics, stringr, RColorBrewer, stats, sp, maptools, and rgdal.

Value

None

Author(s)

James B Pearson, Jr jbpearson353@gmail.com and Linda W Pickle lwpickle353@gmail.com
Maintainer: "Joe Zou" zouj@imsweb.com

Examples

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
#####
#
#  Generate data.frame of all data for the US States and DC
#

data(USStates_CM_St_Data,envir=environment())
str(USStates_CM_St_Data)

#
#####

#####
#
#  Example # s01 - States Mapping Basic defaults
#
#  In this example rate and pValue data is provided for each state.  
#  The number of categories requested is set to 5.  
#  The "pValue" column in the data is used to hatch states when 
#  the pValue > 0.05.  The defaults on the hatch feature are tuned
#  support hatching of pValue data that is not-significate. 
#
#  Border defaults for state data are = stateB=ALL, seerB=NONE.
#
#  This example uses example s1's data.  All state boundaries are drawn.
#

TT   <- c("Ex-s01 States Mapping Cancer Mortality Rate",
            "all defaults")
save.f<-tempfile(pattern = "", fileext = "SM-Ex-s01 States Map of Cancer Mortality-defaults.pdf")
pdf(save.f,width=8,height=10.5)
SeerMapper(USStates_CM_St_Data,mTitle=TT)
dev.off()

#
#  The pValue data in the dataset was assigned 0.02 or 0.2 based on a
#  comparison the state's confidence interval values and the US's rate, 
#  for age adjusted rates for all cancers and cancer deaths for the years
#  2009 to 2013.
#
####

#####
#
#  Example # s02 - States Mapping Basic with Hatching
#
#  In this example rate and pValue data is provided for each state.  
#  The number of categories requested is set to 5.  
#  The "pValue" column in the data is used to hatch states when 
#  the pValue > 0.05.  The defaults on the hatch feature are tuned
#  support hatching of pValue data that is not-significate. 
#
#  Border defaults for state data are = stateB=ALL, seerB=NONE.
#
#  This example uses example s1's data.  All state boundaries are drawn.
#

TT   <- c("Ex-s02 States Mapping Cancer Mortality Rate",
            "w hatching and defaults")
save.f<-tempfile(pattern = "", fileext = "SM-Ex-s02 States Map of Cancer Mortality-w hatching.pdf")
pdf(save.f,width=8,height=10.5)

SeerMapper(USStates_CM_St_Data,
           hatch   = TRUE,
           mTitle  = TT
        )
        
dev.off()

#
#  The pValue data in the dataset was assigned 0.02 or 0.2 based on a
#  comparison the state's confidence interval values and the US's rate, 
#  for age adjusted rates for all cancers and cancer deaths for the years
#  2009 to 2013.
#
####

####
#
#  Generate Partial States data.frame for Examples s04 through s15
#
#  This dataset is created one and re-used.  If the examples
#  are unindependly, the code to generate the dataset must
#  be run first.
#

data(USStates_CM_St_Data,envir=environment())

USStates_P   <- USStates_CM_St_Data         # get copy
numStates    <- dim(USStates_P)[1]          # get number of rows (states)
selectStates <- (runif(numStates) <= 0.75 ) # select random 75% of states
USStates_P   <- USStates_P[selectStates,]   # pull out data

#
#####

#####
#
#  Example # s03 - Partial State Mapping with pValue Hatching
#
#  The package does not have to have data for every state/DC.  Partial
#  data can also be mapped.  States without data are not colored (white).
#
#  This example uses a randomly selected set data for 75 % of the states/DC.  
#
#  The number of categories is set to 5 (categ=5), and hatching 
#  is enabled using the default hatching options on the data column "pValue".
#
#  By default for state level data, the boundaries for all U.S. states/DC are
#  drawn to provide a complete map (stateB="ALL").
#

TT   <- c("Ex-s03 Partial States Map",
          "all defaults with hatching")
save.f<-tempfile(pattern = "", fileext = "SM-Ex-s03 Partial States Map w hatching defaults.pdf")
pdf(save.f,width=8,height=10.5)

SeerMapper(USStates_P,
                hatch   = list(dataCol="pValue"),       # test pValue column for < 0.05 
                mTitle  = TT
             )

dev.off()

#
####

#####
#
#  Example # s04 - Partial State Mapping with pValue Hatching 
#         and boundaries for all states and seer registries.
#
#  If stateB="ALL" and seerB="ALL", then boundaries for all of the states and Seer 
#  Registries are drawn.  This is one solution for the map generated in example # s06.
#

TT   <- c("Ex-s04 Partial State Map w hatching",
          "Outline all States and Regs")
save.f<-tempfile(pattern = "", fileext = "SM-Ex-s04 Partial States Map w hatching stB-A srB-A.pdf")
pdf(save.f,width=8,height=10.5)

SeerMapper(USStates_P,
                stateB  = "ALL",             # outline all states
                seerB   = "ALL",             # outline all registries
                hatch   = TRUE,              # test pValue column for < 0.05 
                mTitle  = TT
              )
dev.off()

#####
#
#  Example # s05 - Partial States Mapping with pValue Hatching 
#         No state boundaries, but boundaries for all Registries
#           stateB=NONE and seerB=ALL
#

TT   <- c("Ex-s05 Partial States Map w hatching, cat=7",
          "No State boundaries, All Regs, w/column names")

ex.f<-"SM-Ex-s05 Partial States Map w hatching cat-7 stB-N srB-A w column names.pdf"
save.f<-tempfile(pattern = "", fileext = ex.f)
pdf(save.f, width=8, height=10.5)

SeerMapper(USStates_P,
           idCol   = "FIPS",dataCol="AA_Rate",
           stateB  = "NONE",        # no state outlines
           seerB   = "ALL",         # all registries
           categ   = 7,             # number of categories to generate and use.
           hatch   = TRUE,          # test pValue column for < 0.05 
           mTitle  = TT
)
dev.off()

#
####

######
#
#  Generate Seer Regs data.frame for 17 of the 20 registries and 
#    a smaller Seer Regs data.frame for the original 12 registries
#    All of the registry data.frames serve as partial data sets.
#    The 12 registry data.frame shows the features the best.
#
#  The following script creates the dataset for use in examples sr30-sr41.
#  Since it is not re-created in the code for each examples, this code
#  must be run or copied to the example as needed.
#

data(SeerRegs_CM_Data,envir=environment())
str(SeerRegs_CM_Data)

# Get US rate for "All_Both" sexes and races.
USRate <- SeerRegs_CM_Data[2,"All_Both"]
cat("USRate:",USRate,"\n")

# strip off first to rows as required
SeerRegs_CM_Data <- SeerRegs_CM_Data[c(-1,-2),]   
# this gets ride of Seer Reg and U.S data.

#  Select data for the original Seer 13 Registries without Alaska.
srList <- c("CT", "MI-DET", "GA-ATL", "GA-RUR", 
            "CA-SF", "CA-SJ", "CA-LA", "HI", "IA", 
            "NM", "WA-SEA", "UT")
SeerRegs_CM_Data_12 <- SeerRegs_CM_Data[srList,]

#

#####
#
#  Example # sr10 - Seer Registry 12 Mapping
#
#  Of the 21 NCI Seer Registries, most mapping occurs using the 
#  12 primary registries. They include: Connecticut, Detroit, 
#  Atlanta, Rural Georgia, Hawaii, Iowa, Utah, New Mexico,
#  Greater California, Greater Georgia, New Jersey, 
#  Kentucky, Louisiana, San Francisco/Oakland, San Jose/Monterey, 
#  Los Angeles, and Seattle-Puget Sound.  
#  The default stateB and seerB call parameter values for 
#  for Seer Registry data are:  stateB="NONE" and seerB="DATA".  
#  The countyB and tractB parameters are ignored.
#
#  This example drawn boundaries for Seer Registries with data,
#  but does not include any state boundaries.  The registries
#  jsut float.  This is useful when you are mapping a few
#  Seer Registries, like Georgia Rural and AtLanta Metro.
#
TT   <- c("Ex-sr10 Seer Reg 12 Map-Cancer Mort. Rates All Both",
          "cat=6, def: stateB-NONE, seerB-DATA" )

ex.f<-"SM-Ex-sr10 Seer Reg 12 Map cat-6 stB-N srB-D.pdf"
save.f<-tempfile(pattern = "", fileext = ex.f)
pdf(save.f, width=8, height=10.5)

SeerMapper(SeerRegs_CM_Data_12,
           idCol   ="Registry",dataCol="All_Both",
           categ   =6,
           mTitle  =TT
)
dev.off()

#
####

#####
#
#  Example # sr11 - Seer Reg All States Map w Hatching
#                 stateB=DATA   seerB=DATA 
#
#  If stateB = "DATA", the boundaries for the states/DC are drawn that 
#  contain Seer Registries with data.
#  This provides the state outlines around Registries with data.
#  Since only a few of the Seer Registries have data, nott all of the 
#  state boundaries are drawn.  A partial U.S. map appears.
#

TT   <- c("Ex-sr11 Seer Reg 12 Map Seer wD and States wD", 
          "stateB=DATA, seerB=DATA")

ex.f<-"SM-Ex-sr11 Seer Reg 12 Map-stB-D, srB-D.pdf"
save.f<-tempfile(pattern = "", fileext = ex.f)
pdf(save.f, width=8, height=10.5)

SeerMapper(SeerRegs_CM_Data_12,
           idCol   = "saID",dataCol="All_Both",
           stateB  = "DATA",  # drawn boundaries for all states.
           mTitle  = TT
)
dev.off()


#####
#
#  Example # sr12 - Seer Reg All States Map w Hatching
#                    stateB=ALL   seerB=ALL 
#
#  With stateB = "ALL", the boundaries for all of the states/DC are drawn.
#  This provides a full U.S. map.  To add the boundaries for all of the 
#  Seer Registries, seerB = "ALL" is set.  
#

TT   <- c("Ex-sr12 Seer Reg 12 Map Seer-A and States-A", 
          "stateB=ALL, seerB=ALL")
ex.f<-"SM-Ex-sr12 Seer Reg 12 Map-stB-A, srB-A.pdf"
save.f<-tempfile(pattern = "", fileext = ex.f)
pdf(save.f, width=8, height=10.5)

SeerMapper(SeerRegs_CM_Data_12,
           idCol   = "saID",dataCol="All_Both",  # specify the column names.
           stateB  = "ALL",  # drawn boundaries for all states.
           seerB   = "ALL",
           mTitle  = TT
)
dev.off()

# #####
# The below examples are uncommented due to the example running time limit on CRAN
# #####
# #
# #  Example # sr20 - Seer Registry West - Level Mapping
# #
# #  With seerB="DATA", the package only maps Seer Registries with data.  
# #  To include the state boundaries, it's best to use stateB="DATA".
# #  Otherwise, the entire US is mapped.
# #
# #  This example maps the western area Seer Registries in California,
# #  New Mexico, Utah and Washington-Seattle/Puget sound.
# #
# 
# TT   <- c("Ex-sr20 Seer Registry Area West Males",
#           "stateB=DATA, seerB=DATA")
# 
# pdf("SM-Ex-sr20 Seer Regs West Males stB-D srB-D.pdf",
#     width=8, height=10.5)
# 
# SeerMapper(SeerRegs_CM_Data_West,
#            idCol   = "Registry",dataCol="All_Males",
#            stateB  ="DATA",
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# #####
# #
# #  Example # sr21 - Seer Registry West - Level Mapping
# #
# #  To drawn the state boundaries in the region, but not the 
# #  entire U.S., stateB can be set to "REGION".  The package
# #  is aware of the 4 U. S. Census regions.  The "REGION" option 
# #  is available with the stateB and seerB boundary controls.
# #
# #  This example maps the western area Seer Registries in California,
# #  New Mexico, Utah and Washington-Seattle/Puget sound with state boundaries
# #  drawn to the western region boundary.
# #
# 
# TT   <- c("Ex-sr21 Seer Registry Area West Males",
#           "w hatching, stateB=REGION, seerB=DATA")
# 
# pdf("SM-Ex-sr21 Seer Regs West Males stB-R srB-D.pdf",
#     width=8, height=10.5)
# 
# SeerMapper(SeerRegs_CM_Data_West,
#            idCol   = "Registry",dataCol="All_Males",
#            stateB  ="REGION",
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# ####
# #
# #  The next set of examples show mapping of county data in many different situations.
# #  The key controls of the border drawing are the stateB, seerB, and countyB call
# #  parameters.  The default values are DATA.  This says, draw the area border only
# #  if there is data provided within the area.  This applies to Seer Registry data, 
# #  county data, and census tract data.  If the call parameter is set to "ALL", the 
# #  associated border is ALWAYS drawn.   If the call parameter is set to "NONE", the 
# #  associated border is almost always not drawn.  See notes below.
# #
# #  The caller has one additional control over when area borders are drawn: the fillTo
# #  call parameter.  Additional borders may be drawn for higher level areas as needed.
# #  If the fillTo call parameter is set to "NONE", only sub-areas (county or tract level)
# #  with data are colored and their borders drawn. This is the default, in most cases.  
# #  If fillTo is set to "SEER", when a Seer Registry area contain any sub-area with data, 
# #  all of the borders at that level are drawn within the Seer Registry area. But not
# #  within the state or neighboring Seer Registry areas.
# #  If fillTo is set to "STATE", when a state contains any sub-area (Seer Registry, county,
# #  tract level) with data, all borders at that level are drawn within the state. 
# #
# ####
# 
# #####
# #
# #  Create a data.frame for All and Partial Kentucky Counties. 
# #
# 
# data(Kentucky_CM_Co_Data,envir=environment())
# str(Kentucky_CM_Co_Data)
# 
# KY_Co_DF <- Kentucky_CM_Co_Data         # start with the fill set of counties.
# 
# lKY      <- dim(KY_Co_DF)[1]            # get number of counties
# selKY    <- (runif(lKY) <= 0.75 )       # select random 75% of counties
# KY_Co_P  <- KY_Co_DF[selKY,]
# 
# #
# #####
# 
# #####
# #
# #  Example # c30 Kentucky All Co Map w hatching, 
# #         default - countyB="DATA", seerB="NONE", stateB="NONE"
# #
# #  In this example, countyB is set to "STATE", to tell the package
# #  to draw all of the county bountaries within any state containing
# #  a county with data.
# #
# 
# TT   <- c("Ex-c30 Kentucky All County Map w hatching",
#           "defaults")
# 
# pdf("SM-Ex-c30 Kentucky All Co Map w hatching-defaults.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(KY_Co_DF,
#            idCol   ="FIPS",dataCol="AA_Rate",
#            hatch   = list(dataCol="pValue"),
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# 
# #####
# #
# #  Example # c31 Kentucky Partial Co Map  
# #         default - countyB="DATA", seerB="NONE", stateB="NONE"
# #
# #  In this example, the only 75 percent of the county have data.
# #  The default settings are used.
# #
# 
# TT   <- c("Ex-c31 Kentucky Partial County Map",
#           "defaults")
# 
# pdf("SM-Ex-c31 Kentucky Partial Co Map-coB-D srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(KY_Co_P,
#            idCol   ="FIPS",dataCol="AA_Rate",
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# #  Not very pretty.
# #
# ####
# 
# 
# #####
# #
# #  Example # c32 Kentucky Partial Co Map  
# #         default - countyB="DATA", seerB="NONE", stateB="NONE"
# #
# #  To improve the c31 map, there are several direction that could be
# #  taken:  Add the state boundaries (stateB="DATA") or draw all of the 
# #  county boundaries (countyB="STATE").  countyB="ALL" is not supported.
# #  In this case, since Kentucky is a single registry, seerB="DATA" has the 
# #  same effect as stateB="DATA".  The difference is stateB="DATA" will not
# #  draw the missing county boundaries, while countyB="STATE" will draw all
# #  of the county boundaries up to the state border.
# #
# 
# TT   <- c("Ex-c32 Kentucky Partial County Map",
#           "stateB='DATA'")
# 
# pdf("SM-Ex-c32 Kentucky Partial Co Map-coB-D srB-N stB-D.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(KY_Co_P,
#            idCol   ="FIPS",dataCol="AA_Rate",
#            stateB  = "DATA",
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# #####
# #
# #  Example # c33 Kentucky Partial Co Map  
# #         default - countyB="DATA", seerB="NONE", stateB="NONE"
# #
# #  This example has the countyB="STATE" set instead of the stateB="DATA"
# #  that was used in c32.
# #
# 
# TT   <- c("Ex-c33 Kentucky Partial County Map",
#           "countyB='STATE'")
# 
# pdf("SM-Ex-c32 Kentucky Partial Co Map-coB-St srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(KY_Co_P,
#            idCol   ="FIPS",dataCol="AA_Rate",
#            countyB  = "STATE",
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# #####
# #
# #  Create a data.frame of the Kentucky and Georgia counties (all)
# #   and a combined county data.frame.
# #
# #   Create a partial list of Georgia Counties.
# #
# 
# data(Georgia_CM_Co_Data,envir=environment())
# GA_Co_Data  <- Georgia_CM_Co_Data
# 
# data(Kentucky_CM_Co_Data,envir=environment())
# KY_Co_Data  <- Kentucky_CM_Co_Data
# 
# TwoStatesData <- rbind(GA_Co_Data,KY_Co_Data)
# 
# lGA         <- dim(GA_Co_Data)[1]       # get number of counties
# selectedGA  <- (runif(lGA) <= 0.75 ) # select random 75% of counties
# GA_Co_P     <- GA_Co_Data[selectedGA,]
# 
# #
# #####
# 
# ####
# #
# #  Example # c35 Multiple States - KY and GA County Mapping
# #             with hatching and stateB = DATA.
# #
# #  This example expands example c36 by setting stateB="DATA".  This 
# #  drawns the Seer Registries around any sets of counties with data.
# #  Counties without data will have boundaries missing.
# #
# 
# TT   <- c("Ex-c35 KY-GA All County Map",
#           "defaults")
# 
# pdf("SM-Ex-c39 KY-GA All Co Map def:coB-D srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(TwoStatesData,
#            idCol   = "FIPS",dataCol="AA_Rate",
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# #  seerB="ALL" and stateB="ALL" could be used, but will drawn 
# #  a map the size of the entire U.S. and the counties and their 
# #  colors will be very hard to see.
# #
# ####
# 
# ####
# #
# #   Create a data.frame for Georgia counties in the Atlanta Registry, 
# #   all counties.
# #
# 
# GA_Co_Data_Atl <- GA_Co_Data[GA_Co_Data$saID == "GA-ATL",]  
# # pull out of the data the Atlanta Registry.
# 
# #
# #   Create a data.frame for the Georgia counties in the 
# #   Atlanta and Rural registries - All and Partial
# #
# 
# GA_Co_Data_Atl_Rur <- GA_Co_Data[(GA_Co_Data$saID == "GA-ATL" |
#                                     GA_Co_Data$saID == "GA-RUR"),]  
# # pull out of the data the Atlanta Registry.
# lGA         <- dim(GA_Co_Data_Atl_Rur)[1]          # get number of counties
# selectedGA  <- (runif(lGA) <= 0.75 )            # select random 75% of counties
# GA_Co_Data_Atl_Rur_P <- GA_Co_Data_Atl_Rur[selectedGA,]
# 
# #
# #####
# 
# #####
# #
# #  Example # c45  GA Single Seer Registry (Atlanta) All Counties 
# #           def: countyB=DATA, seerB=NONE, stateB=NONE
# #
# #  This example the all of the counties in the Georgia Atlanta Metro Seer 
# #  Registry are selected for mapping. The other counties in the state are not 
# #  listed in the data.frame, so have no data associated.  This example 
# #  shows the map using the default boundary 
# #  settings:  countyB="DATA", seerB="NONE", and stateB="NONE".
# #
# 
# TT   <- c("Ex-c45 GA Atlanta Reg Co ",
#           "def countyB=DATA, seerB=NONE, stateB=NONE")
# 
# pdf("SM-Ex-c45 GA Atl Reg Co def coB-D srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Co_Data_Atl,
#            idCol   ="FIPS",dataCol="AA_Rate",
#            mTitle  = TT
# )
# dev.off()
# 
# #
# ####
# 
# #####
# #
# #  Example # c46  GA Single Seer Registry (Atlanta) All Counties 
# #                countyB=DATA, seerB=NONE, stateB=ALL
# #
# #  In this extreme example the more boundaries are drawn then really needed.
# #  The data is lost in the size of the map.  Not a good practice. 
# #  If only a small area contains data, don't enable any set of 
# #  boundaries that cover more than is needed. 
# #  In this case, stateB is set to "ALL".
# #
# 
# TT   <- c("Ex-c46 GA Atlanta Reg Co ",
#           "def countyB=DATA, seerB=NONE, stateB=ALL")
# 
# pdf("SM-Ex-c46 GA Atl Reg Co def coB-D srB-N stB-A.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Co_Data_Atl,
#            idCol   ="FIPS",dataCol="AA_Rate",
#            stateB  ="ALL",
#            mTitle  = TT
# )
# dev.off()
# 
# #
# ####
# 
# ####
# #
# #  Example # c47 GA Two Seer Registry Partial Co Map, 
# #           countyB="DATA", seerB="NONE", stateB="NONE"
# #
# #  This example maps the counties in two Georgia Seer Registries: Atlanta Metro 
# #  and Rural with partial data can be mapped and the affects of the boundary options.
# #  By default only the boundaries and counties with data are mapped.
# #
# 
# TT   <- c("Ex-c47 GA Atl-Rur Reg Partial w def",
#           "def: countyB=DATA seerB=NONE stateB=NONE")
# 
# pdf("SM-Ex-c47 GA Atl-Rur Reg Partial Co def coB-D srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Co_Data_Atl_Rur_P,
#            idCol   ="FIPS",dataCol="AA_Rate",
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# #  NOTE: The boundaries of the state and Seer Registries at not clearly defined.
# #   The package works the same at the tract, county, seer and state levels
# #   with partial data.  The default is draw and fill sub-areas with data.
# #   Each level can be expanded to drawn sub-areas without data to the next
# #   level boundary with xxxxxB = "ALL", "REGION", "STATE", "SEER", 
# #   and "COUNTY" options.
# #
# ####
# 
# 
# 
# #####
# #
# #   Data for the following examples.  2010 census boundaries
# 
# data(GA_Dem10_Co_Data,envir=environment())
# GA_D_Co_Data  <- GA_Dem10_Co_Data
# 
# #####
# #
# #  Examples c60 to c66 use 2010 census demographic data and use the 
# #  SeerMapper2010 function call to activate the 2010 boundary data collection.
# #
# #####
# 
# #####
# #
# #  Example c60 - Georgia County Data-Population Density with defaults
# #
# #  Uses 2010 demographic County data.frame (GA_Dem10_Co_Data) loaded above.
# #
# 
# TT   <- c("Ex-c60 Georgia Counties Population Density10, c=7",
#           "def: countyB='DATA' seerB='NONE' stateB='NONE'")
# 
# pdf("SM-Ex-c60 GA Counties-PopDens10-c=7 def coB-D srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper2010(GA_D_Co_Data,
#                idCol   = "FIPS",dataCol="popdens",
#                categ   = 7,
#                mTitle  = TT
# )
# 
# dev.off()
# 
# #####
# #
# #  Example c61 - Georgia County Dem. Data for age 65 and up
# #
# #  Uses 2010 demographic county data.frame (GA_Dem10_Co_Data) loaded above.
# #
# 
# TT   <- c("Ex-c61 Georgia County Dem10 Counts for age 65 and up.",
#           "def-countyB=DATA, seerB=NONE, stateB=NONE")
# 
# pdf("SM-Ex-c61 GA Counties10-age 65 and up-def coB-D srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper2010(GA_D_Co_Data,
#                idCol   = "FIPS",dataCol="age.65.up",
#                categ   = 7,
#                mTitle  = TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# #####
# #
# #  Example c64 - Georgia County Dem10 Data for Percentage age 65 and up
# #
# #  The Georgia 2010 demographic county Dem dataset (GA_Dem10_Co_Data) 
# #  is used in this example.
# #  The percentage (0% to 100%) of individuals in each tract that is 
# #  65 year old or older is calculated and mapped.
# #
# 
# # calculate the percentage of age 65 up vs population
# 
# GA_D_Co_Data$PC.age.65.up <- ( GA_D_Co_Data$age.65.up / GA_D_Co_Data$pop2010 ) * 100
# 
# TT   <- c("Ex-c64 Georgia County10 for PC 65 and up",
#           "def: countyB='DATA' seerB='NONE' stateB='NONE'")
# 
# pdf("SM-Ex-c64 GA Counties10-PC age 65 and up-def.pdf",
#     width=8,height=10.5)
# 
# SeerMapper2010(GA_D_Co_Data, 
#                idCol   = "FIPS",dataCol="PC.age.65.up",
#                categ   = 7,
#                mTitle  = TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# #####
# #
# #  Example c65 - Georgia County Dem10 Data for Percentage households occupied
# #
# #  Using the Georgia 2010 demographic county dataset (GA_Dem_Co_Data),
# #  the percentage (0% to 100%) of the households that are occupied
# #  in each county is calculated and mapped.
# #
# 
# # Calculate percentage of HH occupied vs HH units.
# 
# GA_D_Co_Data$PC.hh.occupied <- ( GA_D_Co_Data$hh.occupied / GA_D_Co_Data$hh.units ) * 100
# 
# TT   <- c("Ex-c65 GA County10 for PC HH Occupied",
#           "def: countyB='DATA' seerB='NONE' stateB='NONE'")
# 
# pdf("SM-Ex-c65 GA Counties10-PC HH Occupied-trB-D coB-N srB-N stB-N",
#     width=8,height=10.5)
# 
# SeerMapper2010(GA_D_Co_Data, 
#                idCol   = "FIPS",dataCol="PC.hh.occupied",
#                categ   = 7,
#                mTitle  = TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# #####
# #
# #  Example c66 - Georgia County Dem10. Data for Percentage Household Renters
# #
# #  Using the Georgia 2010 demographic county dataset (GA_Dem_Co_Data),
# #  the percentage (0% to 100%) of the households that have renters
# #  in each county is calculated and mapped.
# #
# 
# # calculate percentage of renters (1-owners) vs units
# 
# GA_D_Co_Data$PC.hh.renter <- (1-( GA_D_Co_Data$hh.owner / GA_D_Co_Data$hh.units )) * 100
# 
# TT   <- c("Ex-c66 GA County10 for PC Renters",
#           "countyB='DATA' seerB='NONE' stateB='NONE'")
# 
# pdf("SM-Ex-c66 GA Counties10-PC Renters-trB-D coB-N srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper2010(GA_D_Co_Data, 
#                idCol   = "FIPS",dataCol="PC.hh.renter",
#                categ   = 7,
#                mTitle  = TT
# )
# dev.off()
# 
# #
# #####
# 
# 
# 
# ####
# #
# #   In the situation where all of the counties with data do not reside 
# #   in a Seer Registry, the behavor of the boundary options is a little 
# #   different.
# #
# #   Example # c70 - Washington Seattle-Puget Sound partial Counties.
# #
# #   In this example we have selected a random set of counties from the 
# #   state of Washington.  Some are in the Seattle-Puget sound Seer Registry
# #   and some are not.
# #
# #   The default settings of the boundary options works the same way.
# #   The countyB options works the same, except countyB="SEER" only 
# #   adds the boundaries for counties within a Seer Registry with counties
# #   with data.  The counties outside the Registry is not drawn.
# #
# 
# data(Washington_CM_Co_Data,envir=environment())
# 
# WA_Data        <- Washington_CM_Co_Data
# 
# # have to compensate for NA in the saID list (no registry)
# isNAsa         <- is.na(WA_Data$saID)   
# sL             <- !isNAsa & (WA_Data$saID    == "WA-SEA")   
# # counties with saID set and == "WA-SEA"
# 
# nSL            <- isNAsa | (WA_Data$saID    != "WA-SEA")    
# # counties with saID not set (NA) or != "WA-SEA"
# 
# 
# WA_Data_Seat   <- WA_Data[sL,]  
# WA_Data_NotSeat<- WA_Data[nSL,]  
# 
# # pull out the data for the Washingto-Puget Registry.
# lWA            <- dim(WA_Data_Seat)[1]        # get number of counties
# selectedWA     <- (runif(lWA) <= 0.7 )       # select random 80% of CO in Puget area.
# WA_Data_Seat_P <- WA_Data_Seat[selectedWA,]
# 
# lWA            <- dim(WA_Data_NotSeat)[1]
# selectedNotWA  <- (runif(lWA) <= 0.3 )
# WA_Data_NotSeat_P<- WA_Data_NotSeat[selectedNotWA,]
# 
# WA_P_Data      <- WA_Data_Seat_P
# WA_P_Data      <- rbind(WA_P_Data,WA_Data_NotSeat_P)
# str(WA_P_Data)
# #
# ####
# 
# #####
# #
# #   Example c70 - WA Partial Counties - one Registry (WA-SEAT)
# #
# 
# TT   <- c("Ex-c70 WA-Seat Partial Reg plus Partial Co",
#           "def basic:countyB=DATA, seerB=NONE, stateB=NONE")
# 
# 
# pdf("SM-Ex-c70 WA-Seat Reg Partial Co default basic.pdf", width=8,height=10.5)
# SeerMapper(WA_P_Data)
# dev.off()
# 
# 
# ####
# #
# #  Example - c71 - Washington State - Partial Co. - one Registry.
# #
# #  To make the mapping of partial counties in Washington State
# #  which has one Registry in part of the state, the following 
# #  enhancement can be made for clarity: draw the outline of the 
# #  states with data (Washington) via stateB="DATA",  draw all of
# #  county boundaries within the Registry with data (WA-SEA), 
# #  increase the number of categories from the default of 5 to 7 (categ=7),
# #  add a two (2) line title (mTitle=TT), use column names to locate
# #  the location ID and data in the data data.frame (idCol="FIPS" and 
# #  dataCol="AA_Rate", and add hatching of counties with a pValue > 0.05
# #  hatch=list(dataCol="pValue").
# #
# 
# TT   <- c("Ex-c71 WA-Seat Partial Reg plus Partial Co",
#           "cat-7, hatching, countyB=SEER, seerB=NONE, stateB=DATA")
# 
# 
# pdf("SM-Ex-c71 WA-Seat Reg Partial Co enhd hatch, cat-7, coB=SR, stB-ST.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(WA_P_Data,
#            idCol = "FIPS", dataCol="AA_Rate", # use column names
#            categ = 7,                           # increase from 5 to 7 categories
#            stateB="DATA",                       # provided state outline
#            countyB="SEER",                      # draw all county boundaries up to Registry
#            hatch = list(dataCol="pValue"),      # use column name for pValue and do hatching.
#            mTitle=TT                            # add title (2 lines)
# )
# 
# dev.off()
# 
# #
# ####
# 
# ####
# #
# #  Example - c73 - Washington State - Partial Co. - one Registry.
# #
# #  A different variation on inproving example c70 is to 
# #  draw all of the counties within the state with data (countyB="STATE"),
# #  the outline of the state would only be needed is further accent is required
# #  (stateB="DATA", move the legend from the left to right side and include the 
# #  counts in each category mLegend=list(pos="right",counts=TRUE), and 
# #  since the categories calculated are:
# #    [152.69-157.16], (156.16-164.00], (164.00-168.76], (168.76-172.91], 
# #    (172.91-174.93], (174.93-179.76], and (179.76-194.80]
# #  we can manually set a reasonable set of breakpoints with 
# #  categ=c(157.5, 164.0, 168.75, 173, 175, 180), also 7 categories.
# #
# #
# 
# TT   <- c("Ex-c73 WA-Seat Partial Reg plus Partial Co",
#           "countyB=STATE, seerB=NONE, stateB=NONE brkpointlist")
# 
# pdf("SM-Ex-c73 WA-Seat Reg Partial Co coB-ST srB-N stB-N brkpt.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(WA_P_Data,
#            idCol   = "FIPS",dataCol="AA_Rate",
#            countyB = "STATE",
#            categ   = c(157.5, 164, 168.75, 173, 175, 180),
#            mLegend = list(pos="right",counts=TRUE),
#            brkPtDigits = 2,
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# #####
# 
# 
# #
# #    Example # c72 shows the default settings with countyB="DATA" for atlanta all tracts.
# #    Example # c73 partial data in Washington State - countyB="SEER"
# #    Example # c74 partial data in Washington State - countyB="STATE"
# # 
# 
# #####
# #
# #  Example # c72 Washington Partial Counties
# #         countyB=DATA, seerB=NONE, stateB=NONE (def)
# #
# TT <- c("Ex-c72-Washington Partial Counties","Rates - defaults")
# 
# pdf("SM-Ex-c72-WA-P-Co-Rate-def.pdf", width=7.5, height=10)
# 
# SeerMapper(WA_P_Data,
#            idCol="FIPS",dataCol="AA_Rate",
#            mTitle=TT
# )
# 
# dev.off()
# #
# ####
# 
# #####
# #
# #  Example # c73 Washington Partial Counties
# #         countyB=SEER, seerB=NONE, stateB=NONE (def)
# #
# TT <- c("Ex-c73-Washington Partial Counties","Rates - countyB=SEER")
# 
# pdf("SM-Ex-c73-WA-P-Co=Rate-coB-sr.pdf", width=7.5, height=10)
# 
# SeerMapper(WA_P_Data,
#            idCol="FIPS",dataCol="AA_Rate",
#            countyB="SEER",
#            mTitle=TT
# )
# 
# dev.off()
# #
# ####
# 
# #####
# #
# #  Example # c74 Washington Partial Counties
# #         countyB=STATE, seerB=NONE, stateB=NONE (def)
# #
# TT <- c("Ex-c74-Washington Partial Counties"," Rate Data - countyB=STATE")
# 
# pdf("SM-Ex-c74-WA-P-Co-Rate-coB-st.pdf", width=7.5, height=10)
# 
# SeerMapper(WA_P_Data,
#            idCol="FIPS",dataCol="AA_Rate",
#            countyB="STATE",
#            mTitle=TT
# )
# 
# dev.off()
# #
# ####
# 
# 
# ####
# #
# #  2000 census County Demographic data for Washington State
# #
# data(WA_Dem_Co_Data,envir=environment())
# 
# WA_D_Data        <- WA_Dem_Co_Data
# 
# # have to compensate for NA in the saID list (no registry)
# isNAsa           <- is.na(WA_D_Data$saID)         
# sL               <- !isNAsa & (WA_D_Data$saID == "WA-SEA")  
# # counties with saID set and == "WA-SEA"
# 
# nSL              <- isNAsa | (WA_D_Data$saID  != "WA-SEA")    
# # counties with saID not set (NA) or != "WA-SEA"
# 
# WA_D_Data_Seat   <- WA_D_Data[sL,]  
# WA_D_Data_NotSeat<- WA_D_Data[nSL,]  
# 
# # pull out the data for the Washington-Puget Registry.
# lWA              <- dim(WA_D_Data_Seat)[1]     # get number of counties
# selectedWA       <- (runif(lWA) <= 0.6 )       # select random 80% of CO in Puget area.
# WA_D_Data_Seat_P <- WA_D_Data_Seat[selectedWA,]
# 
# lWA              <- dim(WA_D_Data_NotSeat)[1]
# selectedNotWA    <- (runif(lWA) <= 0.2 )
# WA_D_Data_NotSeat_P<- WA_D_Data_NotSeat[selectedNotWA,]
# 
# WA_D_P_Data      <- WA_D_Data_Seat_P
# WA_D_P_Data      <- rbind(WA_D_P_Data,WA_D_Data_NotSeat_P)
# str(WA_D_P_Data)
# 
# #
# #    Example # c76 shows the default settings with countyB="DATA" for atlanta all tracts.
# #    Example # c77 partial data in Washington State - countyB="SEER"
# #    Example # c78 partial data in Washington State - countyB="STATE"
# # 
# 
# #####
# #
# #  Example # c76 Washington Partial Counties
# #         countyB=DATA, seerB=NONE, stateB=NONE (def)
# #
# TT <- c("Ex-c76-Washington Partial County-Dem","defaults")
# 
# pdf("SM-Ex-c76-WA-Dem-P-Co-def.pdf", width=7.5, height=10)
# 
# SeerMapper(WA_D_P_Data,
#            idCol="FIPS",dataCol="popdens",
#            mTitle=TT
# )
# 
# dev.off()
# #
# ####
# 
# #####
# #
# #  Example # c78 Washington Partial Counties
# #         countyB=SEER, seerB=NONE, stateB=NONE (def)
# #
# TT <- c("Ex-c78-Washington Partial Dem County","countyB=SEER")
# 
# pdf("SM-Ex-c78-WA-Dem-P-Co-coB-sr.pdf", width=7.5, height=10)
# 
# SeerMapper(WA_D_P_Data,
#            idCol="FIPS",dataCol="popdens",
#            countyB="SEER",
#            mTitle=TT
# )
# 
# dev.off()
# #
# ####
# 
# #####
# #
# #  Example # c79 Washington Partial Counties
# #         countyB=STATE, seerB=NONE, stateB=NONE (def)
# #
# TT <- c("Ex-c79-Washington Partial Dem Counties","countyB=STATE")
# 
# pdf("SM-Ex-c79-WA-Dem-P-Co-trB-st.pdf", width=7.5, height=10)
# 
# SeerMapper(WA_D_P_Data,
#            idCol="FIPS",dataCol="popdens",
#            countyB="STATE",
#            mTitle=TT
# )
# 
# dev.off()
# #
# ####
# 
# 
# 
# ####
# #
# #  Have data at the census tract level works exactly the same as data 
# #  at the county level.  The only exception is supplemental boundary 
# #  information datasets may be needed.
# #
# 
# #
# #  Example - c80 - Wash-Balt CSA county level - defaults
# #
# 
# 
# data(WashBaltMetro_Co_Data)
# 
# TT <- c("SM-Ex-c80-Washington-Baltimore Metro","County-Combined Statistics Area-def")
# 
# pdf("SM-Ex-c80-WashBalt-County-CSA-def.pdf", width=7.5, height=10)
# 
# SeerMapper(WashBaltMetro_Co_Data,
#            idCol="FIPS",dataCol="popdens",
#            categ=7,
#            mTitle=TT
# )
# 
# dev.off()
# 
# #
# #  Example - c81 - Wash-Balt CSA County level - stateB="DATA"
# #
# 
# 
# TT <- c("SM-Ex-c81-Washington-Baltimore Metro","County-Combined Statistics Area-stB=D")
# 
# pdf("SM-Ex-c81-WashBalt-County-CSA-stB-D.pdf", width=7.5, height=10)
# 
# SeerMapper(WashBaltMetro_Co_Data,
#            idCol="FIPS",dataCol="popdens",
#            categ=7,
#            stateB="DATA",
#            mTitle=TT
# )
# 
# dev.off()
# #
# ####
# 
# 
# ####
# #
# #  Example - c83 - Kansas City CSA county level - defaults
# #
# 
# 
# data(KCMetro_Co_Data)
# 
# TT <- c("SM-Ex-c83-Kansas City Metro","County-Combined Statistics Area-def")
# 
# pdf("SM-Ex-c83-KCMetro-County-CSA-def.pdf", width=7.5, height=10)
# 
# SeerMapper(KCMetro_Co_Data,
#            idCol="FIPS",dataCol="popdens",
#            categ=7,
#            mTitle = TT
# )
# 
# dev.off()
# 
# #
# #  Example - c84 - Kansas City CSA County level - stateB="DATA"
# #
# 
# 
# TT <- c("SM-Ex-c84-Kansas City Metro","County-Combined Statistics Area-stB=D")
# 
# pdf("SM-Ex-c84-KCMetro-County-CSA-stB-D.pdf", width=7.5, height=10)
# 
# SeerMapper(KCMetro_Co_Data,
#            idCol="FIPS",dataCol="popdens",
#            categ=7,
#            stateB="DATA",
#            mTitle = TT
# )
# 
# dev.off()
# #
# ####
# 
# 
# 
# #
# #  End of County Examples
# #
# 
# #######################
# 
# #####
# #
# #  Example tr60 - Georgia Census Tract Data-Population Density with defaults
# #
# #  Uses 2000 census demographic tract data from the GA_Dem_Tr_Data dataset.
# #
# 
# data(GA_Dem_Tr_Data)
# GA_Tr_DF   <- GA_Dem_Tr_Data
# 
# #
# 
# TT   <- c("Ex-tr60 Georgia Census Tracts Population Density, c=7",
#           "def: tractB=DATA countyB=NONE seerB=NONE stateB=NONE")
# 
# pdf("SM-Ex-tr60 GA Tracts-PopDens-c=7 def trB-D coB-N srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Tr_DF,
#            idCol   = "FIPS",dataCol="popdens",
#            categ   = 7,
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# #####
# 
# #####
# #
# #  Example tr61 - Georgia Census Tract Data for age 65 and up
# #
# #  Uses demographic tract data.frame (GA_Dem_Tr_Data) loaded above.
# #
# 
# TT   <- c("Ex-tr61 Georgia Census Tract for age 65 and up.",
#           "def-tractB=DATA, countyB=NONE, seerB=NONE, stateB=NONE")
# 
# pdf("SM-Ex-tr61 GA Tracts-age 65 and up-def trB-D coB-N srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Tr_DF,
#            idCol   = "FIPS",dataCol="age.65.up",
#            categ   = 7,
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# #####
# 
# #####
# #
# #  Example tr63 - Georgia Census Tract Data for Percentage age 65 and up
# #
# #  The Georgia demographic census tract dataset (GA_Dem_Tr_Data) 
# #  is used in this example.
# #  The percentage (0% to 100%) of individuals in each tract that is 
# #  65 year old or older is calculated and mapped.
# #
# 
# GA_Tr_DF$PC.age.65.up <- ( GA_Tr_DF$age.65.up / GA_Tr_DF$pop2000 ) * 100
# 
# TT   <- c("Ex-tr63 Georgia Tract for PC 65 and up",
#           "def: tractB=DATA countyB=NONE seerB=NONE stateB=NONE")
# 
# pdf("SM-Ex-tr63 GA Tracts-PC age 65 and up-def.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Tr_DF, 
#            idCol   = "FIPS",dataCol="PC.age.65.up",
#            categ   = 7,
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# #####
# 
# #####
# #
# #  Example tr64 - Georgia Census Tract Data for Percentage age 65 and up
# #
# #  The Georgia demographic census tract dataset (GA_Dem_Tr_Data) 
# #  is used in this example. Same as tr63, but tractB=NONE, and countyB=DATA to
# #  turn off the drawing of the tract boundaries, but make sure 
# #  county boundaries are drawn around areas with data.
# #
# #  The value categorized in the map is the percentage (0% to 100%) of 
# #  individuals in each tract that are 65 year old or older.
# #
# 
# GA_Tr_DF$PC.age.65.up <- ( GA_Tr_DF$age.65.up / GA_Tr_DF$pop2000 ) * 100
# 
# TT   <- c("Ex-tr64 Georgia Tract for PC 65 and up",
#           "tractB=NONE countyB=DATA seerB=NONE stateB=NONE")
# 
# pdf("SM-Ex-tr64 GA Tracts-PC age 65 and up-tB-N cB-D.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Tr_DF, 
#            idCol   = "FIPS",dataCol="PC.age.65.up",
#            categ   = 7,
#            tractB  = "NONE",
#            countyB = "DATA",
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# #####
# 
# #####
# #
# #  Example tr65 - Georgia Census Tract Data for Percentage households occupied
# #
# #  Using the Georgia demographic census tract dataset (GA_Dem_Tr_Data),
# #  the percentage (0% to 100%) of the households that are occupied
# #  in each county is calculated and mapped.
# #
# 
# GA_Tr_DF$PC.hh.occupied <- ( GA_Tr_DF$hh.occupied / GA_Tr_DF$hh.units ) * 100
# 
# TT   <- c("Ex-tr65 GA Tract for PC HH Occupied",
#           "def: tractB=DATA countyB=NONE seerB=NONE stateB=NONE")
# 
# pdf("SM-Ex-tr65 GA Tracts-PC HH Occupied-trB-D coB-N srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Tr_DF, 
#            idCol   = "FIPS",dataCol="PC.hh.occupied",
#            categ   = 7,
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# #####
# #
# #  Example tr66 - Georgia Census Tract Data for Percentage Household Renters
# #
# #  Using the Georgia demographic census tract dataset (GA_Dem_Tr_Data),
# #  the percentage (0% to 100%) of the households that have renters
# #  in each county is calculated and mapped.
# #
# 
# GA_Tr_DF$PC.hh.renter <- (1-( GA_Tr_DF$hh.owner / GA_Tr_DF$hh.units )) * 100
# 
# TT   <- c("Ex-tr66 GA Tract for PC Renters",
#           "tractB=DATA countyB=NONE seerB=NONE stateB=NONE")
# 
# pdf("SM-Ex-tr66 GA Tracts-PC Renters-trB-D coB-N srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Tr_DF, 
#            idCol   = "FIPS",dataCol="PC.hh.renter",
#            categ   = 7,
#            mTitle  = TT
# )
# dev.off()
# 
# #
# #####
# 
# 
# ####
# #
# #  To do the same Washington Baltimore Metro area a the census tract level,
# #  the data is collected at the census tract level and filtered
# #  to just the CSA tracts.
# #
# #  To cover all of the conditions in the next two examples:
# #
# 
# #
# #  With the \var{SeerMapperEast} and \var{SeerMapperWest} supplemental 
# #  packages loaded, maps can be created for census tracts in any state or 
# #  district.
# #
# 
# ####
# #
# #  County Cancer Mortality data for Washington State
# #
# data(WA_Dem_Tr_Data,envir=environment())
# 
# WA_D_Data        <- WA_Dem_Tr_Data
# 
# 
# # have to compensate for NA in the saID list (no registry)
# isNAsa           <- is.na(WA_D_Data$saID)          
# sL               <- !isNAsa & (WA_D_Data$saID    == "WA-SEA")   
# # counties with saID set and == "WA-SEA"
# 
# nSL              <- isNAsa | (WA_D_Data$saID    != "WA-SEA")    
# # counties with saID not set (NA) or != "WA-SEA"
# 
# WA_D_Data_Seat   <- WA_D_Data[sL,]  
# WA_D_Data_NotSeat<- WA_D_Data[nSL,]  
# 
# # pull out the data for the Washingto-Puget Registry.
# lWA            <- dim(WA_D_Data_Seat)[1]        # get number of counties
# selectedWA     <- (runif(lWA) <= 0.6 )       # select random 80% of CO in Puget area.
# WA_D_Data_Seat_P <- WA_D_Data_Seat[selectedWA,]
# 
# lWA            <- dim(WA_D_Data_NotSeat)[1]
# selectedNotWA  <- (runif(lWA) <= 0.2 )
# WA_D_Data_NotSeat_P<- WA_D_Data_NotSeat[selectedNotWA,]
# 
# WA_D_P_Data      <- WA_D_Data_Seat_P
# WA_D_P_Data      <- rbind(WA_D_P_Data,WA_D_Data_NotSeat_P)
# str(WA_D_P_Data)
# 
# #
# #    Example # tr76 shows the default settings with tractB="DATA" for atlanta all tracts.
# #    Example # tr77 partial data in Washington State - tractB="COUNTY"
# #    Example # tr78 partial data in Washington State - tractB="SEER"
# #    Example # tr79 partial data in Washington State - tractB="STATE"
# # 
# 
# #####
# #
# #  Example # tr76 Washington Partial Tracts
# #         tractB=DATA, countyB=NONE seerB=NONE, stateB=NONE (def)
# #
# TT <- c("Ex-tr76-Washington Partial Tracts-Demog","defaults")
# 
# pdf("SM-Ex-tr76-WA-Dem-P-Tracts-def.pdf", width=7.5, height=10)
# 
# SeerMapper(WA_D_P_Data,
#            idCol="FIPS",dataCol="popdens",
#            mTitle=TT
# )
# 
# dev.off()
# #
# ####
# 
# #####
# #
# #  Example # tr77 Washington Partial Tracts
# #         tractB=COUNTY, countyB=NONE, seerB=NONE, stateB=NONE (def)
# #
# TT <- c("Ex-tr77-Washington Partial Tracts","tractB=COUNTY")
# 
# pdf("SM-Ex-tr77-WA-Dem-P-Tract-trB-co.pdf", width=7.5, height=10)
# 
# SeerMapper(WA_D_P_Data,
#            idCol="FIPS",dataCol="popdens",
#            tractB="COUNTY",
#            mTitle=TT
# )
# 
# dev.off()
# #
# ####
# 
# #####
# #
# #  Example # tr78 Washington Partial Tracts
# #         tractB=SEER, seerB=NONE, stateB=NONE (def)
# #
# TT <- c("Ex-tr78 Washington Partial Tracts","tractB=SEER")
# 
# pdf("SM-Ex-tr78-WA-Dem-P-Tract-trB-sr.pdf", width=7.5, height=10)
# 
# SeerMapper(WA_D_P_Data,
#            idCol="FIPS",dataCol="popdens",
#            tractB = "SEER",
#            mTitle=TT
# )
# 
# dev.off()
# #
# ####
# 
# 
# #####
# #
# #  Example # tr79 Washington Partial Tracts
# #         tractB=STATE, seerB=NONE, stateB=NONE (def)
# #
# TT <- c("Ex-tr79-Washington Partial Tracts","tractB=STATE")
# 
# pdf("SM-Ex-tr79-WA-Dem-P-Tract-trB-st.pdf", width=7.5, height=10)
# 
# SeerMapper(WA_D_P_Data,
#            idCol="FIPS",dataCol="popdens",
#            countyB="STATE",
#            mTitle=TT
# )
# 
# dev.off()
# #
# ####
# 
# ####
# #
# #  Example - tr83 - Kansas City CSA tract level - defaults
# #
# 
# data(KCMetro_Tr_Data)
# 
# TT <- c("SM-Ex-tr83-Kansas City Metro","Tract-Combined Statistics Area-def")
# 
# pdf("SM-Ex-tr83-KCMetro-Tract-CSA-def.pdf", width=7.5, height=10)
# 
# SeerMapper(KCMetro_Tr_Data,
#            idCol="FIPS",dataCol="popdens",
#            categ=7,
#            mTitle=TT
# )
# 
# dev.off()
# 
# #
# #  Example - tr84 -Kanssa City CSA tract level - stateB="DATA"
# #
# 
# 
# TT <- c("SM-Ex-tr84-Kansas City Metro","Tract-Combined Statistics Area-stB=D")
# 
# pdf("SM-Ex-tr84-KCMetro-CSA-stB-D.pdf", width=7.5, height=10)
# 
# SeerMapper(KCMetro_Tr_Data,
#            idCol="FIPS",dataCol="popdens",
#            categ=7,
#            stateB="DATA",
#            mTitle=TT
# )
# 
# dev.off()
# #
# ####
# 
# 
# #####
# #
# #  Data.frame for Georgia Tracts ALL, Partial Atlanta Registry  2000 census
# #
# 
# data(GA_Dem_Tr_Data,envir=environment()) 
# 
# GA_Tr_DF         <- GA_Dem_Tr_Data
# 
# lGA              <- dim(GA_Tr_DF)[1]
# selectedTr       <- (runif(lGA) <= 0.75)
# GA_Tr_P          <- GA_Tr_DF[selectedTr,]  
# # select a random part (75%) of Georgia Tracts.
# 
# GA_Tr_ATL_DF     <- GA_Tr_DF[GA_Tr_DF$saID == "GA-ATL",]  
# # select Atlanta Reg. Tracts
# 
# lATL             <- dim(GA_Tr_ATL_DF)[1]
# GA_Tr_ATL_P      <- GA_Tr_ATL_DF[(runif(lATL) <= 0.75),]
# 
# GA_Tr_ATLRUR_DF  <- GA_Tr_DF[(GA_Tr_DF$saID == "GA-ATL" | GA_Tr_DF$saID == "GA-RUR"),] 
# # select Atlanta & Rural Regs
# 
# lATLRUR          <- dim(GA_Tr_ATLRUR_DF)[1]
# GA_Tr_ATLRUR_P   <- GA_Tr_ATLRUR_DF[(runif(lATLRUR) <= 0.75),]  
# # select a random set of tracts
# #
# #####
# 
# #####
# #
# #  The use of census tract location IDs and data works identically 
# #  to the county mapping shown above.  The only difference is th e
# #  extra county boundary layer.  The tractB call parameter
# #  allows tract boundaries to be drawn at the data level or up to the 
# #  county, Seer Registry, or State levels.
# #
# 
# #
# #  Example # tr90 - Georgia ALL Tracts Map with defaults
# #    demonstrate the defaults setting - map tracts with data, 
# #    tractB="DATA", countyB="NONE", seerB="NONE", stateB="NONE".
# #
# #    Demonstrates simple census tract mapping with 7 categories and 
# #    the default boundary controls.
# #
# 
# TT   <- c("Ex-tr90 Georgia All Tracts Map-2000 popDensity",
#           "Defaults")
# 
# pdf("SM-Ex-tr90 GA All Tracts Map-Def trB-D coB-N srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Tr_DF,
#            idCol   = "FIPS",dataCol="popdens",
#            mTitle  = TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# #####
# #
# #     This example maps the tracts assocated with the Georgia Atlanta Seer Registry.
# #     The defaults of tractB="DATA", countyB="NONE", sserB="NONE", and stateB="NONE"
# #     are used.
# #
# #     Alternate boundary controls would have the following affects:
# #       tractB="SEER" has little effect, since all of the tracts within the registry are
# #          present.
# #       countyB="DATA". countyB="SEER" and seerB="DATA" would only affect the map
# #          by drawing heavier bounaries at each level.  Remember registry boundaries 
# #          are on county boundaries.
# #
# #     The drawing of the tract boundaries can be expanded by:
# #       tractB="COUNTY" will draw all of the tracts within the counties 
# #          with tracts with data.  Any tract or county in the Seer Registry or State
# #          will not be drawn or colors.  You will not see any shared boundaries.
# #       tractB="STATE" will draw all of the tracts within the states with tracts with data.
# #          All tracts within a state with a tract with data will be drawn.  Nothing will
# #          be missed.
# #
# 
# ####
# #
# #  Example tr91 - Georgia Tract - Altanta Registry
# #
# #     When partial tract data is present, use the settings that will present the 
# #     data and it's relationship to the surroundings and nothing more.  Don't use
# #     stateB="ALL" or seerB="ALL.  For small areas of data, these are very useful.
# #
# TT   <- c("Ex-tr91 GA ATL Reg All Tracts",
#           "default:tractB=DATA, countyB=NONE, seerB=NONE, stateB=NONE")
# 
# pdf("SM-Ex-tr91 GA ATL Reg Tracts def-trB-D coB-N Sr-N St-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Tr_ATL_DF,
#            idCol   ="FIPS",dataCol="popdens",
#            mTitle  =TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# 
# ####
# #
# #  Example tr92 - Georgia Tract - Altanta Registry
# #
# #     When partial tract data is present, use the settings that will present the 
# #     data and it's relationship to the surroundings and nothing more.  Don't use
# #     stateB="ALL" or seerB="ALL.  For small areas of data, these are very useful.
# #
# TT   <- c("Ex-tr92 GA ATL Reg All Tracts",
#           "def:tractB=SEER, countyB=NONE, seerB=NONE, stateB=NONE")
# 
# pdf("SM-Ex-tr92 GA ATL Reg Tracts def-trB-sr coB-N Sr-N St-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Tr_ATL_DF,
#            idCol   ="FIPS",dataCol="popdens",
#            tractB  ="SEER",
#            mTitle  =TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# 
# ####
# #
# #  Example tr93 - Georgia Tract - Altanta Registry
# #
# #     When partial tract data is present, use the settings that will present the 
# #     data and it's relationship to the surroundings and nothing more.  Don't use
# #     stateB="ALL" or seerB="ALL.  For small areas of data, these are very useful.
# #
# TT   <- c("Ex-tr93 GA ATL Reg All Tracts",
#           "def:tractB=STATE, countyB=NONE, seerB=NONE, stateB=NONE")
# 
# pdf("SM-Ex-tr93 GA ATL Reg Tracts def-trB-st coB-N Sr-N St-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Tr_ATL_DF,
#            idCol   ="FIPS",dataCol="popdens",
#            tractB  ="STATE",
#            mTitle  =TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# ####
# #
# #  Example tr94 - Georgia Tract - Altanta Registry
# #
# #     When partial tract data is present, use the settings that will present the 
# #     data and it's relationship to the surroundings and nothing more.  Don't use
# #     stateB="ALL" or seerB="ALL.  For small areas of data, these are very useful.
# #
# 
# TT   <- c("Ex-tr94 GA ATL Reg Partial Tracts-Def",
#           "tractB=DATA, countyB=NONE, seerB=NONE, stateB=NONE")
# 
# pdf("SM-Ex-tr94 GA ATL Partial Tracts trB-D coB-N srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_Tr_ATL_DF,
#            idCol   ="FIPS",dataCol="popdens",
#            categ   =7,
#            tractB  ="STATE",   
#            mTitle  =TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# #####
# #
# #  Example H02 & H04 - Hatching of non-pValue data, line density, 
# #       and color  
# #
# #  Using the Georgia demographic county dataset (GA_Dem_Co_Data) 
# #   population density to demonstrate:
# #      Hatching of non-pValue type data (popdens), operation set 
# #      to "<", value set to mean of all population densities, color 
# #      changed to blue, palette changed reds, request 6 categories.
# #      
# #
# 
# data(GA_Dem_Co_Data, envir=environment())
# GA_D_Co_Data  <- GA_Dem_Co_Data
# 
# meanPopDens     <- mean(GA_D_Co_Data$popdens)
# cat("meanPopDens:",meanPopDens,"\n")
# 
# TT   <- c("Ex-H02 Georgia Co w hatching of > mean popdens", "")
# 
# pdf("SM-Ex-H02 GA Co hatch-ge mean popdens.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_D_Co_Data, 
#            idCol     = "FIPS",dataCol="popdens",
#            categ     = 6,               # use 6 categories
#            hatch     = list(col="black",
#                             dataCol="popdens",ops=">", value=meanPopDens),
#            palColors = "RdYlGn",
#            mTitle    = TT
# )
# 
# dev.off()
# 
# #
# #####
# 
# #####
# #
# #  Example H04 - Hatching of non-pValue data, line density, 
# #       and color  
# #
# 
# meanPopDens     <- mean(GA_D_Co_Data$popdens)
# cat("meanPopDens:",meanPopDens,"\n")
# 
# TT   <- c("Ex-H04 Georgia Co w hatching of > mean popdens",
#           "den=15, angle=60")
# 
# pdf("SM-Ex-H04 GA Co hatch-ge mean popdens-d15 a60.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_D_Co_Data, 
#            idCol     = "FIPS",dataCol="popdens",
#            categ     = 6,               # use 6 categories
#            hatch     = list(col="red", den=15, angle=60,
#                             dataCol="popdens",ops=">",value=meanPopDens),
#            palColors = "BuGn",
#            mTitle    = TT
# )
# 
# dev.off()
# 
# #
# #####
# 
# #####
# #
# #  The next set of examples look at options to change how the maps will look.
# #
# #  Example P01 - Georgia County Data for Percentage Household Renters
# #
# #  In the extreme you can assign your own colors to each sub-area.
# #  In this example, I have randomly assigned a color from a 
# #  RColorBrewer "Accent" palette to each sub-areas.  The color
# #  is placed in the "dataCol" for the sub-area and categ is set to "COLORS".
# #
# #  Options:  - Use colors instead of data
# #            - turning off the legend.
# #
# library(RColorBrewer)
# 
# data(GA_Dem_Co_Data,envir=environment())
# GA_D_Co_Data <- GA_Dem_Co_Data
# 
# lGA_D_Co    <- dim(GA_D_Co_Data)[1]
# numColrs  <- 8
# ColorSet  <- brewer.pal(numColrs,"Accent")
# 
# numRep      <- (lGA_D_Co/numColrs)+1
# # place colors into the data.frame.
# GA_D_Co_Data$Col <- replicate(numRep, ColorSet)[1:lGA_D_Co]
# 
# TT   <- c("Ex-p01 Georgia All County-Random Accent Colors Test",
#           "def: countyB=DATA seerB=NONE stateB=NONE")
# 
# pdf("SM-Ex-p01 GA Co-Random-Colors-coB-D srB-N stB-N.pdf",
#     width=8,height=10.5)
# 
# SeerMapper(GA_D_Co_Data, 
#            idCol   ="FIPS",dataCol="Col",  # new data column name
#            categ   ="colors",            # specify how to do the categorization
#            mLegend = FALSE,              # turn off the legend.
#            mTitle  =TT
# )
# 
# dev.off()
# 
# #
# ####
# 
# 
# 
# #
# #  end of examples
# #
# #####

  #
  # Reference: Mapping it out, Mark Monnier - benefit of characterization 
  #    and simplification for a more visible map.  
  #
  #    Still need simplification and maintain same area and 
  #    relationships/neigborships.
  #
  #    Purpose of map is to illustrate spatial patterns of the mapped 
  #    variable.  It is important that each area be visible and that 
  #    the spatial relationship be maintain.  It is not important the 
  #    area's shape if maintained.
  #
  #    Centroids and Convex Hulls...  Also population centroid.
 

SeerMapper documentation built on Jan. 15, 2021, 3:16 p.m.