library('terra')
data('kentucky')
kentucky = terra::unwrap(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')
kentuckyTract = unwrap(kentuckyTract)
length(kentuckyTract)
if(require('mapmisc', quietly=TRUE)) {
mycol = colourScale(kentucky2$SMR,
breaks=10, dec=-log10(0.5), style='quantile')
plot(kentucky2, col=mycol$plot, border='#00000040')
legendBreaks('topright', mycol)
} else {
terra::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)))
Run the code above in your browser using DataLab