pref2dist {lazy.tools}R Documentation

Convert Japanese Prefecture to District

Description

Convert Japanese Prefecture to District

Usage

pref2dist(pref = NULL, type = 1, dist = NULL, dump = 0)

Arguments

pref

string vector containing prefecture names

type

= 1 to use 8 districs = 2 to use 14 districts

dist

Not Yet Available

dump

= 1 to return the prefecture-district table

Value

a string vector of the same length as pref containing district names
or, when dump=1, a table of prefecturesn and the corresponding districts.

Examples


# string vector containing prefecture names
Prefectures <- pref2dist(dump=1)$pref

# prefecture name to prefecture number
PrefecturesNo <- 1:47
names(PrefecturesNo) <- Prefectures
pn <- PrefecturesNo[Prefectures[c(13,26)]]

# prefecture name to district
d1 <- pref2dist( Prefectures )
d2 <- pref2dist( Prefectures, type=2 )
pn <- PrefecturesNo[Prefectures]
printm( pn, Prefectures, d1, d2 )

# invalid prefecture names
pref <- c(Prefectures[13],"Iowa", Prefectures[26])
pref2dist( pref, type=1 )
pref2dist( pref, type=2 )


[Package lazy.tools version 0.1.4 ]