Description Usage Format Details Examples
Data set contains the information of population, by age, sex, and census subdivision.
1 | data('kentucky')
|
A SpatialPolygonsDataFrame
of Kentucky boundaries and populations,
case numbers for each county, and a vector of cancer rates by age and sex group.
larynx
is a data.frame
of cancer case counts by county,
obtained from http://www.cancer-rates.info and are for a single
deliberately unspecified year.
kentucky
contains country boundaries and populations.
kentuckyTract
contains census tract boundaries and populations.
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 | data('kentucky')
head(larynx)
10^5*larynxRates[paste(c("M","F"), 50, sep="_")]
kentucky2 = getSMR(kentucky, larynxRates, larynx,
regionCode="County")
names(kentucky2)
length(kentucky2)
data('kentuckyTract')
length(kentuckyTract)
if(require('mapmisc', quietly=TRUE)) {
mycol = colourScale(kentucky2$SMR,
breaks=10, dec=-log10(0.5), style='quantile')
map.new(kentucky2)
plot(kentucky2, col=mycol$plot, border='#00000040',add=TRUE)
legendBreaks('topright', mycol)
} else {
plot(kentucky2)
}
breaks = c(0,1,seq(2, ceiling(max(kentucky2$SMR,na.rm=TRUE)),by=2))
thecol = terrain.colors(length(breaks)-1)
plot(kentucky2, col = thecol[cut(kentucky2$SMR,
breaks,include.lowest=TRUE)] )
legend("topleft", pch=15, pt.cex=2.5, adj=c(0,15),
legend=rev(breaks), col=c(NA, rev(thecol)))
## Not run:
# the data were created with
larynxRates= cancerRates("USA", year=1998:2002,site="Larynx")
load(url("http://biogeo.ucdavis.edu/data/gadm2/R/USA_adm2.RData"))
kentucky = gadm[gadm$NAME_1 =="Kentucky",]
# population data
download.file(
"http://www.census.gov/popest/data/counties/asrh/2011/files/CC-EST2011-ALLDATA-21.csv",
destfile =
"/store/patrick/spatialData/C-EST2011-ALLDATA-21.csv")
# file layout
download.file(
"http://www.census.gov/popest/data/counties/asrh/2011/files/CC-EST2011-ALLDATA.pdf",
destfile = "/store/patrick/spatialData/kentuckyPopFormat.pdf")
kpop = read.table(
"/store/patrick/spatialData/C-EST2011-ALLDATA-21.csv",
header=TRUE,as.is=TRUE,sep=",")
kpop = kpop[kpop$YEAR==1 & kpop$AGEGRP != 0, ]
names(kpop) = gsub("^TOT_","", names(kpop))
names(kpop) = gsub("(EM)?ALE$","", names(kpop))
kpop$age = (kpop$AGEGRP-1)*5
kpop$County = gsub(" County$", "", kpop$CTYNAME)
kpop = kpop[,c("County","age","M","F")]
kpop2 = reshape(kpop,direction="wide", idvar="County",
v.names=c("M","F"), timevar="age")
rownames(kpop2) = kpop2$County
# poverty
download.file(
paste(
"http://www.ers.usda.gov/ReportExport.aspx?reportPath=/State_Fact_Sheets/",
"PovertyReport&stat_year=2011&stat_type=0&fips_st=21&",
"exportType=EXCEL&exportName=PovertyReport",
sep=""),
destfile="/store/patrick/spatialData/poverty.xls")
library('gdata')
kpov = read.xls("/store/patrick/spatialData/poverty.xls",
header=TRUE,skip=3)
kpov = kpov[!is.na(kpov$Percent),c("FIPS.", "Name","Percent")]
rownames(kpov) = kpov$Name
kpop2$poverty = kpov[rownames(kpop2), "Percent"]
# merge population and spatial data
kdata = kpop2[kentucky$NAME_2,]
rownames(kdata) = NULL
kentucky = SpatialPolygonsDataFrame(
polygons(kentucky),
data=kdata,match.ID=FALSE)
larynx <- structure(
list(County = c("Hickman", "Caldwell", "Anderson",
"Marion", "Wayne", "Lincoln", "Livingston", "Montgomery", "Adair",
"Henderson", "Knox", "Martin", "Monroe", "Wolfe", "Breathitt",
"Fleming", "Woodford", "Garrard", "Bracken", "Barren", "Lawrence",
"Logan", "Clark", "Scott", "Madison", "Oldham", "Clay", "Russell",
"Shelby", "Letcher", "Campbell", "Graves", "Johnson", "Metcalfe",
"Pulaski", "Bullitt", "Knott", "Boyd", "Ohio", "Bath", "Butler",
"Todd", "Mercer", "Green", "Greenup", "Larue", "Calloway", "Webster",
"Morgan", "Pendleton", "Mason", "Hardin", "Lewis", "McCreary",
"Spencer", "Union", "Marshall", "Jessamine", "Henry", "Trigg",
"Pike", "Nelson", "Jefferson", "Floyd", "Bourbon", "McCracken",
"Boone", "Kenton", "Grayson", "Taylor", "Hopkins", "Boyle", "Meade",
"Fayette", "Daviess", "Harlan", "Warren", "Christian", "Magoffin",
"Carter", "Hart", "Lee", "Elliott", "Edmonson", "Crittenden",
"Leslie", "Laurel", "Cumberland", "Menifee", "Fulton", "Carlisle",
"McLean", "Owsley", "Carroll", "Estill", "Harrison", "Owen",
"Breckinridge", "Nicholas", "Bell", "Trimble", "Allen", "Rowan",
"Simpson", "Perry", "Powell", "Rockcastle", "Hancock", "Robertson",
"Franklin", "Washington", "Casey", "Clinton", "Lyon", "Muhlenberg",
"Ballard", "Gallatin", "Whitley", "Grant", "Jackson", "Breathitt",
"Nicholas", "Bracken", "Todd", "Magoffin", "Pendleton", "Metcalfe",
"Webster", "Leslie", "Henry", "Union", "Adair", "Casey", "Pike",
"Jessamine", "Nelson", "Garrard", "Pulaski", "Meade", "Harlan",
"Floyd", "Carter", "Shelby", "Barren", "Franklin", "Boyd", "Jefferson",
"Fayette", "Hopkins", "Kenton", "Warren", "Bullitt", "Knox",
"Butler", "Bourbon", "Elliott", "Johnson", "Estill", "Boone",
"Boyle", "Breckinridge", "Bell", "Crittenden", "Cumberland",
"Daviess", "Edmonson", "Calloway", "Caldwell", "Anderson", "Ballard",
"Bath", "Allen", "Graves", "Clinton", "Fleming", "Fulton", "Gallatin",
"Grayson", "Hardin", "Lincoln", "Green", "Greenup", "Hancock",
"Grant", "Harrison", "Laurel", "Larue", "Henderson", "Hickman",
"Lewis", "Letcher", "Hart", "Lawrence", "Lee", "Jackson", "Ohio",
"Taylor", "Owen", "Monroe", "Madison", "Trigg", "Spencer", "Washington",
"Trimble", "Scott", "Simpson", "Mason", "Marion", "Lyon", "Logan",
"McCracken", "Mercer", "Menifee", "McCreary", "Marshall", "Martin",
"McLean", "Woodford", "Wolfe", "Knott", "Montgomery", "Perry",
"Powell", "Christian", "Clark", "Campbell", "Carlisle", "Carroll",
"Robertson", "Rockcastle", "Rowan", "Russell", "Wayne", "Whitley",
"Oldham", "Muhlenberg", "Owsley", "Livingston", "Morgan", "Clay"
),
Cases = c(2, 3, 3, 3, 4, 3, 1, 3, 3, 5, 3, 2, 2, 1, 2, 2,
2, 2, 1, 4, 2, 3, 4, 3, 7, 4, 2, 2, 3, 2, 6, 3, 1, 1, 5, 4, 1,
3, 1, 1, 1, 1, 1, 1, 3, 1, 2, 1, 1, 1, 1, 4, 1, 1, 1, 1, 2, 2,
1, 1, 3, 1, 28, 2, 1, 2, 3, 5, 1, 1, 2, 1, 1, 6, 2, 1, 2, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 2, 2, 1, 3, 1, 1, 1,
1, 1, 1, 1, 1, 11, 3, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
sex = c("M",
"M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M",
"M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M",
"M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M",
"M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M",
"M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M",
"M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M",
"M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M",
"M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M",
"M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M", "M",
"M", "M", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F",
"F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F",
"F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F",
"F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F",
"F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F",
"F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F",
"F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F",
"F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F",
"F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F",
"F", "F", "F", "F", "F")),
.Names = c("County", "Cases", "sex"),
row.names = 1:240, class = "data.frame")
larynx$age=NA
save(kentucky, larynx, larynxRates,
file="~/workspace/diseasemapping/pkg/diseasemapping/data/kentucky.RData",
compress='xz')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.