Pages

2013-04-15

subdivisionjp.R

I made an R version of the conversion tool for the names of principal subdivision in Japan.

subdivisionjp.zip (Download page at Google Drive)

Documentation
http://rpubs.com/ogura/5493

(Update: 2013-04-16 22:50 JST)
I didn't know of package Nippon, which includes prefectures table and many other useful features.
I wonder if you should have Unicode data in Unicode character codes like "<U+6771><U+4EAC><U+90FD>" instead of "東京都".
If you have original data in Unicode characters like "<U+6771><U+4EAC><U+90FD>", R console outputs text in a readable way, but the original data itself is less human-readable.
If you have original data directly put like "東京都" (I don't know the name of representation), the original data is human-readable, but console outputs garbled text.

Converting principal subdivision names in Japan

When handling data sets, Japanese characters are almost always a pain in the neck because of garbled text in data-processing software such as R.
Replacing Japanese characters with Roman notations manually is a very tedious task that many people may not want to do.
Commonly used names like principal subdivisions, or prefecture (the United States' counterparts are states), among others, would be handy if you can get their Roman notations quickly.
So I made a script to convert names of Japan's principal subdivisions between Japanese (Kanji) and Roman.

iso3166-2jp (Google Apps Script. I don't know why, but Google sign-in is required to view the code though I'm sharing it for anonymous access.)

If you make a copy of the above script and include it as a library, you can use its functions in your Google Sheets.



Japan's principal subdivisions:
http://en.wikipedia.org/wiki/ISO_3166-2:JP
http://ja.wikipedia.org/wiki/ISO_3166-2:JP