March 5, 2014

Visualize diabetes in USA

How to make diabetes map in USA

To check the disease map in the USA, the CDC Diabetes Interactive Atlas is a very powerful tool.

Large amounts of data, maps, tables, and motion charts can be viewed in an interactive way.

In Japan, there seems to be no tools like this.

Therefore, I try to visualize diabetes in Japan,through mimicking the CDC Atlas.

I have divided the visualization in two steps.

  1. Learn how to make a diabetes map through mimicing the CDC Atlas

  2. Apply step1 to the Japanese case.

Today, I shall try step one.

How to make diabetes map in USA

To visualize diabetes map in USA, there is two steps.

1. Get data from

You can download data from CDC site.

I decided to use “Diagnosed Diabetes Incidence Estimates”.

2. Make an interactive map

To mimic CDC Atlas, you have to make an interactive map, not a static map.

Don't worry. This is a easy step. Just use rMaps library.

But, you have to take care to use abbreviation name for states name.

If not, a map is not colored appropriately.

So What ?

As you can see, I succeed to make a disease map of diabetes.

To apply the procedure to the Japanese case, there seems to be two bottlenecks.

  1. Get diabetes data in Japan

  2. Get geographic data in Japan

As for No1, we can use diabetes statistics of MHLW in Japan.

Here is the URL.

I think No2 will be a very hard step.

Using rMaps, we have to make use of TopoJSON data of Japan.

There, however, seems to be no TopoJSON data for public use.

Then I need to process a public shape file into TopoJSON by myself. I'm not good at this step, so It will take much time.

When I grasped how to make TopoJSON data in Japan, I will try step two.


DMdata <- read.csv("", = TRUE, skip = 1)
DMdata <- DMdata[, c("State", grep("Age.adjusted.Rate.per", colnames(DMdata), 
    value = TRUE))]
colnames(DMdata) <- c("State", paste(sep = "", 1996:2010, "percent"))
DMdata <- reshape2::melt(DMdata, id.var = "State")
DMdata$variable <- as.character(DMdata$variable) %>% gsub(pattern = "percent", 
    replacement = "") %>% as.numeric()
colnames(DMdata) <- c("State", "Year", "Incidence")
DMdata$Incidence <- as.numeric(DMdata$Incidence)
DMdata <- subset(DMdata, complete.cases(DMdata))
DMdata$State <-[match(as.character(DMdata$State),]
i1 <- ichoropleth(Incidence ~ State, data = DMdata, animate = "Year", play = TRUE)
i1$show("iframesrc", cdn = TRUE)


  1. 凄い!勉強になりました。

  2. Hello. Have you found any solution of the geographic data of Japan ?
    I found someone already created TopoJSON data of Japan.
    But I failed to visualize a total cancer mortality rate map of Japan.. (data can be found here: