Skip to content

Instantly share code, notes, and snippets.

@ramnathv
Last active January 1, 2016 17:08
Show Gist options
  • Save ramnathv/8174770 to your computer and use it in GitHub Desktop.
Save ramnathv/8174770 to your computer and use it in GitHub Desktop.
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://d3js.org/topojson.v1.min.js' type='text/javascript'></script>
<script src='http://datamaps.github.io/scripts/datamaps.all.min.js' type='text/javascript'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.min.js' type='text/javascript'></script>
<style>
.rChart {
display: block;
margin-left: auto;
margin-right: auto;
width: 800px;
height: 400px;
}
</style>
</head>
<body>
<div id='chart4fd14a53066b' class='rChart datamaps'></div>
<script id='popup-template' type='text/x-handlebars-template'>
</script>
<script>
var chartParams = {
"dom": "chart4fd14a53066b",
"width": 800,
"height": 400,
"scope": "usa",
"fills": {
"5": "#F1EEF6",
"1": "#D7B5D8",
"4": "#DF65B0",
"3": "#DD1C77",
"2": "#980043"
},
"data": {
"AK": {
"State": "Alaska",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.11,
"Adult_Obesity_Rate": 0.624,
"state": "AK",
"fillKey": 5
},
"AL": {
"State": "Alabama",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " Yes ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.17,
"Adult_Obesity_Rate": 0.623,
"state": "AL",
"fillKey": 5
},
"AR": {
"State": "Arkansas",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " Yes ",
"Mandates_BMI_Screening": " Yes ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.16,
"Adult_Obesity_Rate": 0.619,
"state": "AR",
"fillKey": 4
},
"AZ": {
"State": "Arizona",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " Yes ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.12,
"Adult_Obesity_Rate": 0.535,
"state": "AZ",
"fillKey": 1
},
"CA": {
"State": "California",
"Approach_to_Address_Childhood_Obesity": " School nutrition program ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.13,
"Adult_Obesity_Rate": 0.579,
"state": "CA",
"fillKey": 3
},
"CO": {
"State": "Colorado",
"Approach_to_Address_Childhood_Obesity": " School nutrition program ",
"State_Task_Force_Committee": " Yes ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.1,
"Adult_Obesity_Rate": 0.523,
"state": "CO",
"fillKey": 1
},
"CT": {
"State": "Connecticut",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.12,
"Adult_Obesity_Rate": 0.552,
"state": "CT",
"fillKey": 2
},
"DE": {
"State": "Delaware",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " Yes ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.15,
"Adult_Obesity_Rate": 0.605,
"state": "DE",
"fillKey": 4
},
"FL": {
"State": "Florida",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " Yes ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.14,
"Adult_Obesity_Rate": 0.582,
"state": "FL",
"fillKey": 3
},
"GA": {
"State": "Georgia",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " Yes ",
"Childhood_Obesity_Rate": 0.16,
"Adult_Obesity_Rate": 0.605,
"state": "GA",
"fillKey": 4
},
"HI": {
"State": "Hawaii",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.13,
"Adult_Obesity_Rate": 0.514,
"state": "HI",
"fillKey": 1
},
"IA": {
"State": "Iowa",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.13,
"Adult_Obesity_Rate": 0.602,
"state": "IA",
"fillKey": 4
},
"ID": {
"State": "Idaho",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.1,
"Adult_Obesity_Rate": 0.583,
"state": "ID",
"fillKey": 3
},
"IL": {
"State": "Illinois",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " Yes ",
"Mandates_BMI_Screening": " Yes ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.16,
"Adult_Obesity_Rate": 0.582,
"state": "IL",
"fillKey": 3
},
"IN": {
"State": "Indiana",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " Yes ",
"Childhood_Obesity_Rate": 0.16,
"Adult_Obesity_Rate": 0.595,
"state": "IN",
"fillKey": 3
},
"KS": {
"State": "Kansas",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.14,
"Adult_Obesity_Rate": 0.58,
"state": "KS",
"fillKey": 3
},
"KY": {
"State": "Kentucky",
"Approach_to_Address_Childhood_Obesity": " School nutrition program ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.21,
"Adult_Obesity_Rate": 0.625,
"state": "KY",
"fillKey": 5
},
"LA": {
"State": "Louisiana",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.17,
"Adult_Obesity_Rate": 0.623,
"state": "LA",
"fillKey": 5
},
"MA": {
"State": "Massachusetts",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.14,
"Adult_Obesity_Rate": 0.529,
"state": "MA",
"fillKey": 1
},
"MD": {
"State": "Maryland",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " Yes ",
"Childhood_Obesity_Rate": 0.13,
"Adult_Obesity_Rate": 0.582,
"state": "MD",
"fillKey": 3
},
"ME": {
"State": "Maine",
"Approach_to_Address_Childhood_Obesity": " School nutrition program ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.13,
"Adult_Obesity_Rate": 0.569,
"state": "ME",
"fillKey": 3
},
"MI": {
"State": "Michigan",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.14,
"Adult_Obesity_Rate": 0.605,
"state": "MI",
"fillKey": 4
},
"MN": {
"State": "Minnesota",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.1,
"Adult_Obesity_Rate": 0.594,
"state": "MN",
"fillKey": 3
},
"MO": {
"State": "Missouri",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " Yes ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.16,
"Adult_Obesity_Rate": 0.624,
"state": "MO",
"fillKey": 5
},
"MS": {
"State": "Mississippi",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.18,
"Adult_Obesity_Rate": 0.649,
"state": "MS",
"fillKey": 5
},
"MT": {
"State": "Montana",
"Approach_to_Address_Childhood_Obesity": " Physical education program ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.11,
"Adult_Obesity_Rate": 0.547,
"state": "MT",
"fillKey": 2
},
"NC": {
"State": "North Carolina",
"Approach_to_Address_Childhood_Obesity": " School nutrition program ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.19,
"Adult_Obesity_Rate": 0.594,
"state": "NC",
"fillKey": 3
},
"ND": {
"State": "North Dakota",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.12,
"Adult_Obesity_Rate": 0.62,
"state": "ND",
"fillKey": 4
},
"NE": {
"State": "Nebraska",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.12,
"Adult_Obesity_Rate": 0.602,
"state": "NE",
"fillKey": 4
},
"NH": {
"State": "New Hampshire",
"Approach_to_Address_Childhood_Obesity": " Physical education program ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.13,
"Adult_Obesity_Rate": 0.574,
"state": "NH",
"fillKey": 3
},
"NJ": {
"State": "New Jersey",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.14,
"Adult_Obesity_Rate": 0.553,
"state": "NJ",
"fillKey": 2
},
"NM": {
"State": "New Mexico",
"Approach_to_Address_Childhood_Obesity": " School nutrition program ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.17,
"Adult_Obesity_Rate": 0.582,
"state": "NM",
"fillKey": 3
},
"NV": {
"State": "Nevada",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " Yes ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.12,
"Adult_Obesity_Rate": 0.562,
"state": "NV",
"fillKey": 2
},
"NY": {
"State": "New York",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " Yes ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.15,
"Adult_Obesity_Rate": 0.568,
"state": "NY",
"fillKey": 3
},
"OH": {
"State": "Ohio",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.14,
"Adult_Obesity_Rate": 0.603,
"state": "OH",
"fillKey": 4
},
"OK": {
"State": "Oklahoma",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.15,
"Adult_Obesity_Rate": 0.606,
"state": "OK",
"fillKey": 4
},
"OR": {
"State": "Oregon",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.14,
"Adult_Obesity_Rate": 0.565,
"state": "OR",
"fillKey": 2
},
"PA": {
"State": "Pennsylvania",
"Approach_to_Address_Childhood_Obesity": " School nutrition program ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " Yes ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.13,
"Adult_Obesity_Rate": 0.592,
"state": "PA",
"fillKey": 3
},
"RI": {
"State": "Rhode Island",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.12,
"Adult_Obesity_Rate": 0.558,
"state": "RI",
"fillKey": 2
},
"SC": {
"State": "South Carolina",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.19,
"Adult_Obesity_Rate": 0.623,
"state": "SC",
"fillKey": 5
},
"SD": {
"State": "South Dakota",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.12,
"Adult_Obesity_Rate": 0.607,
"state": "SD",
"fillKey": 4
},
"TN": {
"State": "Tennessee",
"Approach_to_Address_Childhood_Obesity": " School nutrition program ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " Yes ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.2,
"Adult_Obesity_Rate": 0.593,
"state": "TN",
"fillKey": 3
},
"TX": {
"State": "Texas",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.19,
"Adult_Obesity_Rate": 0.588,
"state": "TX",
"fillKey": 3
},
"UT": {
"State": "Utah",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.11,
"Adult_Obesity_Rate": 0.543,
"state": "UT",
"fillKey": 2
},
"VA": {
"State": "Virginia",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " Yes ",
"Childhood_Obesity_Rate": 0.11,
"Adult_Obesity_Rate": 0.589,
"state": "VA",
"fillKey": 3
},
"VT": {
"State": "Vermont",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " Yes ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.14,
"Adult_Obesity_Rate": 0.542,
"state": "VT",
"fillKey": 2
},
"WA": {
"State": "Washington",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " Yes ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.21,
"Adult_Obesity_Rate": 0.565,
"state": "WA",
"fillKey": 2
},
"WI": {
"State": "Wisconsin",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.09,
"Adult_Obesity_Rate": 0.591,
"state": "WI",
"fillKey": 3
},
"WV": {
"State": "West Virginia",
"Approach_to_Address_Childhood_Obesity": " Both ",
"State_Task_Force_Committee": " Yes ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.14,
"Adult_Obesity_Rate": 0.636,
"state": "WV",
"fillKey": 5
},
"WY": {
"State": "Wyoming",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " Yes ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.15,
"Adult_Obesity_Rate": 0.596,
"state": "WY",
"fillKey": 4
},
"NA": {
"State": "District of Columbia",
"Approach_to_Address_Childhood_Obesity": " None ",
"State_Task_Force_Committee": " No ",
"Mandates_BMI_Screening": " No ",
"Mandates_Obesity_Treatment_Coverage": " No ",
"Childhood_Obesity_Rate": 0.23,
"Adult_Obesity_Rate": 0.521,
"state": null,
"fillKey": 1
}
},
"id": "chart4fd14a53066b"
}
chartParams.element = document.getElementById('chart4fd14a53066b')
var mapchart4fd14a53066b = new Datamap(chartParams);
// draw a bubble map if specified
if (chartParams.bubbles) {
var bubbles = chartParams.bubbles
mapchart4fd14a53066b.bubbles(bubbles)
}
if (chartParams.labels){
mapchart4fd14a53066b.labels()
}
</script>
<style>
.datamaps {
position: relative;
}
</style>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "rCharts_choro"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": "Choropleth Maps with rCharts"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "This is just a quick script expounding a bit on the example provided by [Ramnath Vaidyanathan](http://rcharts.io/viewer/?6735051#.Ur3MGN_xCak)."
},
{
"cell_type": "code",
"collapsed": false,
"input": "%load_ext rmagic",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": "The rmagic extension is already loaded. To reload it, use:\n %reload_ext rmagic\n"
}
],
"prompt_number": 11
},
{
"cell_type": "markdown",
"metadata": {},
"source": "We can first grab the example obesity data from Berkeley."
},
{
"cell_type": "code",
"collapsed": false,
"input": "%%R\n\n# read data and replace dots in names with underscores\nobesity = read.csv(\n 'http://www.stat.berkeley.edu/classes/s133/data/obesity.csv',\n stringsAsFactors = F\n)\n\nprint(head(obesity))",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"text": " State Approach.to.Address.Childhood.Obesity State.Task.Force.Committee\n1 Alabama Both Yes \n2 Alaska None No \n3 Arizona Both Yes \n4 Arkansas Both Yes \n5 California School nutrition program No \n6 Colorado School nutrition program Yes \n Mandates.BMI.Screening Mandates.Obesity.Treatment.Coverage\n1 No No \n2 No No \n3 No No \n4 Yes No \n5 No No \n6 No No \n Childhood.Obesity.Rate Adult.Obesity.Rate\n1 0.17 0.623\n2 0.11 0.624\n3 0.12 0.535\n4 0.16 0.619\n5 0.13 0.579\n6 0.10 0.523\n"
}
],
"prompt_number": 12
},
{
"cell_type": "markdown",
"metadata": {},
"source": "For some reason that may soon be apparenty, Ramnath has chosen to replace the periods in the variable names with underscores."
},
{
"cell_type": "code",
"collapsed": false,
"input": "%%R\n\nnames(obesity) = gsub(\"\\\\.\", \"_\", names(obesity))\n\nprint(head(obesity))",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"text": " State Approach_to_Address_Childhood_Obesity State_Task_Force_Committee\n1 Alabama Both Yes \n2 Alaska None No \n3 Arizona Both Yes \n4 Arkansas Both Yes \n5 California School nutrition program No \n6 Colorado School nutrition program Yes \n Mandates_BMI_Screening Mandates_Obesity_Treatment_Coverage\n1 No No \n2 No No \n3 No No \n4 Yes No \n5 No No \n6 No No \n Childhood_Obesity_Rate Adult_Obesity_Rate\n1 0.17 0.623\n2 0.11 0.624\n3 0.12 0.535\n4 0.16 0.619\n5 0.13 0.579\n6 0.10 0.523\n"
}
],
"prompt_number": 13
},
{
"cell_type": "markdown",
"metadata": {},
"source": "We also need to add abbreviated state names, presumably to sync up with the map."
},
{
"cell_type": "code",
"collapsed": false,
"input": "%%R\n\nlibrary(plyr)\nlibrary(stringr)\n\n#Trim the white space from State and create an abbreviated version called state\nobesity = plyr::mutate(obesity, \n State = str_trim(State),\n state = state.abb[match(State, state.name)],\n)\n\nprint(head(obesity))",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"text": " State Approach_to_Address_Childhood_Obesity State_Task_Force_Committee\n1 Alabama Both Yes \n2 Alaska None No \n3 Arizona Both Yes \n4 Arkansas Both Yes \n5 California School nutrition program No \n6 Colorado School nutrition program Yes \n Mandates_BMI_Screening Mandates_Obesity_Treatment_Coverage\n1 No No \n2 No No \n3 No No \n4 Yes No \n5 No No \n6 No No \n Childhood_Obesity_Rate Adult_Obesity_Rate state\n1 0.17 0.623 AL\n2 0.11 0.624 AK\n3 0.12 0.535 AZ\n4 0.16 0.619 AR\n5 0.13 0.579 CA\n6 0.10 0.523 CO\n"
}
],
"prompt_number": 14
},
{
"cell_type": "markdown",
"metadata": {},
"source": "A little reminder on what mutate does..."
},
{
"cell_type": "code",
"collapsed": false,
"input": "%%R\nlibrary(plyr)\n\nprint(help(mutate))",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": "R Help on \u2018mutate\u2019mutate package:plyr R Documentation\n\n_\bM_\bu_\bt_\ba_\bt_\be _\ba _\bd_\ba_\bt_\ba _\bf_\br_\ba_\bm_\be _\bb_\by _\ba_\bd_\bd_\bi_\bn_\bg _\bn_\be_\bw _\bo_\br _\br_\be_\bp_\bl_\ba_\bc_\bi_\bn_\bg _\be_\bx_\bi_\bs_\bt_\bi_\bn_\bg _\bc_\bo_\bl_\bu_\bm_\bn_\bs.\n\n_\bD_\be_\bs_\bc_\br_\bi_\bp_\bt_\bi_\bo_\bn:\n\n This function is very similar to \u2018transform\u2019 but it executes the\n transformations iteratively so that later transformations can use\n the columns created by earlier transformations. Like transform,\n unnamed components are silently dropped.\n\n_\bU_\bs_\ba_\bg_\be:\n\n mutate(.data, ...)\n \n_\bA_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs:\n\n .data: the data frame to transform\n\n ...: named parameters giving definitions of new columns.\n\n_\bD_\be_\bt_\ba_\bi_\bl_\bs:\n\n Mutate seems to be considerably faster than transform for large\n data frames.\n\n_\bS_\be_\be _\bA_\bl_\bs_\bo:\n\n \u2018subset\u2019, \u2018summarise\u2019, \u2018arrange\u2019. For another somewhat different\n approach to solving the same problem, see \u2018within\u2019.\n\n_\bE_\bx_\ba_\bm_\bp_\bl_\be_\bs:\n\n # Examples from transform\n mutate(airquality, Ozone = -Ozone)\n mutate(airquality, new = -Ozone, Temp = (Temp - 32) / 1.8)\n \n # Things transform can't do\n mutate(airquality, Temp = (Temp - 32) / 1.8, OzT = Ozone / Temp)\n \n # mutate is rather faster than transform\n system.time(transform(baseball, avg_ab = ab / g))\n system.time(mutate(baseball, avg_ab = ab / g))\n \n"
}
],
"prompt_number": 15
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Here is the part I was unclear about. I see no shapefile being read in, so we need to dissect the `choropleth` method."
},
{
"cell_type": "code",
"collapsed": false,
"input": "%%R\n\n#Create map\nmap<-rCharts::choropleth(\n cut(Adult_Obesity_Rate, 5, labels = F) ~ state,\n data = obesity,\n pal = 'PuRd'\n)\n\n#Save map to HTML\nmap$save('rChart_map.html',cdn=TRUE)",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 16
},
{
"cell_type": "code",
"collapsed": false,
"input": "#Define display function\ndef display_rchart(filename):\n from IPython.display import display, HTML, Javascript\n display(HTML(\"<iframe src=files/\" + filename + \"/\" + \" width=850 height=430 seamless></iframe>\"))\ndisplay_rchart('rChart_map.html')",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe src=files/rChart_map.html/ width=850 height=430 seamless></iframe>",
"metadata": {},
"output_type": "display_data",
"text": "<IPython.core.display.HTML at 0x109a1bc90>"
}
],
"prompt_number": 20
},
{
"cell_type": "code",
"collapsed": false,
"input": "map2 = %R paste(capture.output(map$show('iframesrc', cdn = TRUE)), collapse = '\\n')\nfrom IPython.display import display, HTML\nHTML(map2[0])",
"language": "python",
"metadata": {},
"outputs": [
{
"html": "<iframe srcdoc='\n&lt;!doctype HTML&gt;\n&lt;meta charset = &#039;utf-8&#039;&gt;\n&lt;html&gt;\n &lt;head&gt;\n \n &lt;script src=&#039;http://d3js.org/d3.v3.min.js&#039; type=&#039;text/javascript&#039;&gt;&lt;/script&gt;\n &lt;script src=&#039;http://d3js.org/topojson.v1.min.js&#039; type=&#039;text/javascript&#039;&gt;&lt;/script&gt;\n &lt;script src=&#039;http://datamaps.github.io/scripts/datamaps.all.min.js&#039; type=&#039;text/javascript&#039;&gt;&lt;/script&gt;\n &lt;script src=&#039;http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.min.js&#039; type=&#039;text/javascript&#039;&gt;&lt;/script&gt;\n \n &lt;style&gt;\n .rChart {\n display: block;\n margin-left: auto; \n margin-right: auto;\n width: 800px;\n height: 400px;\n } \n &lt;/style&gt;\n \n &lt;/head&gt;\n &lt;body&gt;\n &lt;div id=&#039;chart4fd15ed60e90&#039; class=&#039;rChart datamaps&#039;&gt;&lt;/div&gt; \n \n &lt;script id=&#039;popup-template&#039; type=&#039;text/x-handlebars-template&#039;&gt;\n \n&lt;/script&gt;\n&lt;script&gt;\n var chartParams = {\n &quot;dom&quot;: &quot;chart4fd15ed60e90&quot;,\n&quot;width&quot;: 800,\n&quot;height&quot;: 400,\n&quot;scope&quot;: &quot;usa&quot;,\n&quot;fills&quot;: {\n &quot;5&quot;: &quot;#F1EEF6&quot;,\n&quot;1&quot;: &quot;#D7B5D8&quot;,\n&quot;4&quot;: &quot;#DF65B0&quot;,\n&quot;3&quot;: &quot;#DD1C77&quot;,\n&quot;2&quot;: &quot;#980043&quot; \n},\n&quot;data&quot;: {\n &quot;AK&quot;: {\n &quot;State&quot;: &quot;Alaska&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.11,\n&quot;Adult_Obesity_Rate&quot;: 0.624,\n&quot;state&quot;: &quot;AK&quot;,\n&quot;fillKey&quot;: 5 \n},\n&quot;AL&quot;: {\n &quot;State&quot;: &quot;Alabama&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; Yes &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.17,\n&quot;Adult_Obesity_Rate&quot;: 0.623,\n&quot;state&quot;: &quot;AL&quot;,\n&quot;fillKey&quot;: 5 \n},\n&quot;AR&quot;: {\n &quot;State&quot;: &quot;Arkansas&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; Yes &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; Yes &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.16,\n&quot;Adult_Obesity_Rate&quot;: 0.619,\n&quot;state&quot;: &quot;AR&quot;,\n&quot;fillKey&quot;: 4 \n},\n&quot;AZ&quot;: {\n &quot;State&quot;: &quot;Arizona&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; Yes &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.12,\n&quot;Adult_Obesity_Rate&quot;: 0.535,\n&quot;state&quot;: &quot;AZ&quot;,\n&quot;fillKey&quot;: 1 \n},\n&quot;CA&quot;: {\n &quot;State&quot;: &quot;California&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; School nutrition program &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.13,\n&quot;Adult_Obesity_Rate&quot;: 0.579,\n&quot;state&quot;: &quot;CA&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;CO&quot;: {\n &quot;State&quot;: &quot;Colorado&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; School nutrition program &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; Yes &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.1,\n&quot;Adult_Obesity_Rate&quot;: 0.523,\n&quot;state&quot;: &quot;CO&quot;,\n&quot;fillKey&quot;: 1 \n},\n&quot;CT&quot;: {\n &quot;State&quot;: &quot;Connecticut&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.12,\n&quot;Adult_Obesity_Rate&quot;: 0.552,\n&quot;state&quot;: &quot;CT&quot;,\n&quot;fillKey&quot;: 2 \n},\n&quot;DE&quot;: {\n &quot;State&quot;: &quot;Delaware&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; Yes &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.15,\n&quot;Adult_Obesity_Rate&quot;: 0.605,\n&quot;state&quot;: &quot;DE&quot;,\n&quot;fillKey&quot;: 4 \n},\n&quot;FL&quot;: {\n &quot;State&quot;: &quot;Florida&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; Yes &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.14,\n&quot;Adult_Obesity_Rate&quot;: 0.582,\n&quot;state&quot;: &quot;FL&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;GA&quot;: {\n &quot;State&quot;: &quot;Georgia&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; Yes &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.16,\n&quot;Adult_Obesity_Rate&quot;: 0.605,\n&quot;state&quot;: &quot;GA&quot;,\n&quot;fillKey&quot;: 4 \n},\n&quot;HI&quot;: {\n &quot;State&quot;: &quot;Hawaii&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.13,\n&quot;Adult_Obesity_Rate&quot;: 0.514,\n&quot;state&quot;: &quot;HI&quot;,\n&quot;fillKey&quot;: 1 \n},\n&quot;IA&quot;: {\n &quot;State&quot;: &quot;Iowa&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.13,\n&quot;Adult_Obesity_Rate&quot;: 0.602,\n&quot;state&quot;: &quot;IA&quot;,\n&quot;fillKey&quot;: 4 \n},\n&quot;ID&quot;: {\n &quot;State&quot;: &quot;Idaho&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.1,\n&quot;Adult_Obesity_Rate&quot;: 0.583,\n&quot;state&quot;: &quot;ID&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;IL&quot;: {\n &quot;State&quot;: &quot;Illinois&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; Yes &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; Yes &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.16,\n&quot;Adult_Obesity_Rate&quot;: 0.582,\n&quot;state&quot;: &quot;IL&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;IN&quot;: {\n &quot;State&quot;: &quot;Indiana&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; Yes &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.16,\n&quot;Adult_Obesity_Rate&quot;: 0.595,\n&quot;state&quot;: &quot;IN&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;KS&quot;: {\n &quot;State&quot;: &quot;Kansas&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.14,\n&quot;Adult_Obesity_Rate&quot;: 0.58,\n&quot;state&quot;: &quot;KS&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;KY&quot;: {\n &quot;State&quot;: &quot;Kentucky&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; School nutrition program &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.21,\n&quot;Adult_Obesity_Rate&quot;: 0.625,\n&quot;state&quot;: &quot;KY&quot;,\n&quot;fillKey&quot;: 5 \n},\n&quot;LA&quot;: {\n &quot;State&quot;: &quot;Louisiana&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.17,\n&quot;Adult_Obesity_Rate&quot;: 0.623,\n&quot;state&quot;: &quot;LA&quot;,\n&quot;fillKey&quot;: 5 \n},\n&quot;MA&quot;: {\n &quot;State&quot;: &quot;Massachusetts&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.14,\n&quot;Adult_Obesity_Rate&quot;: 0.529,\n&quot;state&quot;: &quot;MA&quot;,\n&quot;fillKey&quot;: 1 \n},\n&quot;MD&quot;: {\n &quot;State&quot;: &quot;Maryland&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; Yes &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.13,\n&quot;Adult_Obesity_Rate&quot;: 0.582,\n&quot;state&quot;: &quot;MD&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;ME&quot;: {\n &quot;State&quot;: &quot;Maine&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; School nutrition program &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.13,\n&quot;Adult_Obesity_Rate&quot;: 0.569,\n&quot;state&quot;: &quot;ME&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;MI&quot;: {\n &quot;State&quot;: &quot;Michigan&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.14,\n&quot;Adult_Obesity_Rate&quot;: 0.605,\n&quot;state&quot;: &quot;MI&quot;,\n&quot;fillKey&quot;: 4 \n},\n&quot;MN&quot;: {\n &quot;State&quot;: &quot;Minnesota&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.1,\n&quot;Adult_Obesity_Rate&quot;: 0.594,\n&quot;state&quot;: &quot;MN&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;MO&quot;: {\n &quot;State&quot;: &quot;Missouri&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; Yes &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.16,\n&quot;Adult_Obesity_Rate&quot;: 0.624,\n&quot;state&quot;: &quot;MO&quot;,\n&quot;fillKey&quot;: 5 \n},\n&quot;MS&quot;: {\n &quot;State&quot;: &quot;Mississippi&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.18,\n&quot;Adult_Obesity_Rate&quot;: 0.649,\n&quot;state&quot;: &quot;MS&quot;,\n&quot;fillKey&quot;: 5 \n},\n&quot;MT&quot;: {\n &quot;State&quot;: &quot;Montana&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Physical education program &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.11,\n&quot;Adult_Obesity_Rate&quot;: 0.547,\n&quot;state&quot;: &quot;MT&quot;,\n&quot;fillKey&quot;: 2 \n},\n&quot;NC&quot;: {\n &quot;State&quot;: &quot;North Carolina&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; School nutrition program &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.19,\n&quot;Adult_Obesity_Rate&quot;: 0.594,\n&quot;state&quot;: &quot;NC&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;ND&quot;: {\n &quot;State&quot;: &quot;North Dakota&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.12,\n&quot;Adult_Obesity_Rate&quot;: 0.62,\n&quot;state&quot;: &quot;ND&quot;,\n&quot;fillKey&quot;: 4 \n},\n&quot;NE&quot;: {\n &quot;State&quot;: &quot;Nebraska&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.12,\n&quot;Adult_Obesity_Rate&quot;: 0.602,\n&quot;state&quot;: &quot;NE&quot;,\n&quot;fillKey&quot;: 4 \n},\n&quot;NH&quot;: {\n &quot;State&quot;: &quot;New Hampshire&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Physical education program &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.13,\n&quot;Adult_Obesity_Rate&quot;: 0.574,\n&quot;state&quot;: &quot;NH&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;NJ&quot;: {\n &quot;State&quot;: &quot;New Jersey&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.14,\n&quot;Adult_Obesity_Rate&quot;: 0.553,\n&quot;state&quot;: &quot;NJ&quot;,\n&quot;fillKey&quot;: 2 \n},\n&quot;NM&quot;: {\n &quot;State&quot;: &quot;New Mexico&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; School nutrition program &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.17,\n&quot;Adult_Obesity_Rate&quot;: 0.582,\n&quot;state&quot;: &quot;NM&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;NV&quot;: {\n &quot;State&quot;: &quot;Nevada&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; Yes &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.12,\n&quot;Adult_Obesity_Rate&quot;: 0.562,\n&quot;state&quot;: &quot;NV&quot;,\n&quot;fillKey&quot;: 2 \n},\n&quot;NY&quot;: {\n &quot;State&quot;: &quot;New York&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; Yes &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.15,\n&quot;Adult_Obesity_Rate&quot;: 0.568,\n&quot;state&quot;: &quot;NY&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;OH&quot;: {\n &quot;State&quot;: &quot;Ohio&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.14,\n&quot;Adult_Obesity_Rate&quot;: 0.603,\n&quot;state&quot;: &quot;OH&quot;,\n&quot;fillKey&quot;: 4 \n},\n&quot;OK&quot;: {\n &quot;State&quot;: &quot;Oklahoma&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.15,\n&quot;Adult_Obesity_Rate&quot;: 0.606,\n&quot;state&quot;: &quot;OK&quot;,\n&quot;fillKey&quot;: 4 \n},\n&quot;OR&quot;: {\n &quot;State&quot;: &quot;Oregon&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.14,\n&quot;Adult_Obesity_Rate&quot;: 0.565,\n&quot;state&quot;: &quot;OR&quot;,\n&quot;fillKey&quot;: 2 \n},\n&quot;PA&quot;: {\n &quot;State&quot;: &quot;Pennsylvania&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; School nutrition program &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; Yes &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.13,\n&quot;Adult_Obesity_Rate&quot;: 0.592,\n&quot;state&quot;: &quot;PA&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;RI&quot;: {\n &quot;State&quot;: &quot;Rhode Island&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.12,\n&quot;Adult_Obesity_Rate&quot;: 0.558,\n&quot;state&quot;: &quot;RI&quot;,\n&quot;fillKey&quot;: 2 \n},\n&quot;SC&quot;: {\n &quot;State&quot;: &quot;South Carolina&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.19,\n&quot;Adult_Obesity_Rate&quot;: 0.623,\n&quot;state&quot;: &quot;SC&quot;,\n&quot;fillKey&quot;: 5 \n},\n&quot;SD&quot;: {\n &quot;State&quot;: &quot;South Dakota&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.12,\n&quot;Adult_Obesity_Rate&quot;: 0.607,\n&quot;state&quot;: &quot;SD&quot;,\n&quot;fillKey&quot;: 4 \n},\n&quot;TN&quot;: {\n &quot;State&quot;: &quot;Tennessee&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; School nutrition program &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; Yes &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.2,\n&quot;Adult_Obesity_Rate&quot;: 0.593,\n&quot;state&quot;: &quot;TN&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;TX&quot;: {\n &quot;State&quot;: &quot;Texas&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.19,\n&quot;Adult_Obesity_Rate&quot;: 0.588,\n&quot;state&quot;: &quot;TX&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;UT&quot;: {\n &quot;State&quot;: &quot;Utah&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.11,\n&quot;Adult_Obesity_Rate&quot;: 0.543,\n&quot;state&quot;: &quot;UT&quot;,\n&quot;fillKey&quot;: 2 \n},\n&quot;VA&quot;: {\n &quot;State&quot;: &quot;Virginia&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; Yes &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.11,\n&quot;Adult_Obesity_Rate&quot;: 0.589,\n&quot;state&quot;: &quot;VA&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;VT&quot;: {\n &quot;State&quot;: &quot;Vermont&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; Yes &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.14,\n&quot;Adult_Obesity_Rate&quot;: 0.542,\n&quot;state&quot;: &quot;VT&quot;,\n&quot;fillKey&quot;: 2 \n},\n&quot;WA&quot;: {\n &quot;State&quot;: &quot;Washington&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; Yes &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.21,\n&quot;Adult_Obesity_Rate&quot;: 0.565,\n&quot;state&quot;: &quot;WA&quot;,\n&quot;fillKey&quot;: 2 \n},\n&quot;WI&quot;: {\n &quot;State&quot;: &quot;Wisconsin&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.09,\n&quot;Adult_Obesity_Rate&quot;: 0.591,\n&quot;state&quot;: &quot;WI&quot;,\n&quot;fillKey&quot;: 3 \n},\n&quot;WV&quot;: {\n &quot;State&quot;: &quot;West Virginia&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; Both &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; Yes &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.14,\n&quot;Adult_Obesity_Rate&quot;: 0.636,\n&quot;state&quot;: &quot;WV&quot;,\n&quot;fillKey&quot;: 5 \n},\n&quot;WY&quot;: {\n &quot;State&quot;: &quot;Wyoming&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; Yes &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.15,\n&quot;Adult_Obesity_Rate&quot;: 0.596,\n&quot;state&quot;: &quot;WY&quot;,\n&quot;fillKey&quot;: 4 \n},\n&quot;NA&quot;: {\n &quot;State&quot;: &quot;District of Columbia&quot;,\n&quot;Approach_to_Address_Childhood_Obesity&quot;: &quot; None &quot;,\n&quot;State_Task_Force_Committee&quot;: &quot; No &quot;,\n&quot;Mandates_BMI_Screening&quot;: &quot; No &quot;,\n&quot;Mandates_Obesity_Treatment_Coverage&quot;: &quot; No &quot;,\n&quot;Childhood_Obesity_Rate&quot;: 0.23,\n&quot;Adult_Obesity_Rate&quot;: 0.521,\n&quot;state&quot;: null,\n&quot;fillKey&quot;: 1 \n} \n},\n&quot;id&quot;: &quot;chart4fd15ed60e90&quot; \n}\n chartParams.element = document.getElementById(&#039;chart4fd15ed60e90&#039;)\n \n \n var mapchart4fd15ed60e90 = new Datamap(chartParams);\n \n \n \n // draw a bubble map if specified\n if (chartParams.bubbles) {\n var bubbles = chartParams.bubbles\n mapchart4fd15ed60e90.bubbles(bubbles)\n }\n \n if (chartParams.labels){\n mapchart4fd15ed60e90.labels()\n }\n&lt;/script&gt;\n\n&lt;style&gt;\n.datamaps {\n position: relative;\n}\n&lt;/style&gt;\n \n &lt;/body&gt;\n&lt;/html&gt;\n' scrolling='no' seamless></iframe>\n<style>iframe{ width: 100%; height: 400px;}</style>",
"metadata": {},
"output_type": "pyout",
"prompt_number": 18,
"text": "<IPython.core.display.HTML at 0x109a1ce50>"
}
],
"prompt_number": 18
},
{
"cell_type": "code",
"collapsed": false,
"input": "",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 18
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment