Last data update: 2014.03.03

R: Get statistical data from http://statdb.nstac.go.jp/
getStatsDataR Documentation

Get statistical data from http://statdb.nstac.go.jp/

Description

Get statistical data that you specify the data ID from “Gateway to Advanced and User-friendly Statistics Service” (http://statdb.nstac.go.jp/) organized by Japanese government.

Usage

getStatsData(statsDataId = NULL, dataSetId = NULL, limit = NULL,
             lvTab = "", cdTab = NULL, lvTime = "", cdTime = NULL,
             lvArea = "", cdArea = NULL)

Arguments

statsDataId

statistical data ID (character)

dataSetId

dataset ID you made (character)

limit

Maximum number of data to download

lvTab

Level of tables to download

cdTab

Code of tables to download (comma separated characters)

lvTime

Level of survey date to download

cdTime

Code of survey date to download (comma separated characters)

lvArea

Level of area to download

cdArea

Code of area to download (comma separated characters)

Details

Data includes some levels of tables, survey dates and areas. For example, data ID 0003009759 includes 1 table (the number of buildings), 1 survey date (year 2008) and 112 areas (prefectures and cities). Level 2 of area shows prefectures, level 3 shows the city parts of each prefecture, and level 4 shows the major cities (e.g. Sapporo, Yokohama, Nagoya, etc.). You can specify the level of table, time and area to download data. If you don't specify the level, all levels are included to data.

Value

It returns the “jpstat” object, which includes

ID

data ID

Stat name

statistics name of government

Government

goverment (ministry) that has the authority of data

Statistics name

provided statistics name

Title

title of data

Survey date

survey date

Tables

data body

Tables is a list that contains tables, and each table is data frame.

Author(s)

Kiwamu Ishikura <ishikura.kiwamu@gmail.com>

References

http://statdb.nstac.go.jp/system-info/api/api-spec/

Examples

getStatsList("Hokkaido AND population", surveyYears = 2008)
hpop20 <- getStatsData("0003009759")
head(hpop20@data[[1L]])

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Rjpstatdb)
Loading required package: RCurl
Loading required package: bitops
Loading required package: XML
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Rjpstatdb/getStatsData.Rd_%03d_medium.png", width=480, height=480)
> ### Name: getStatsData
> ### Title: Get statistical data from http://statdb.nstac.go.jp/
> ### Aliases: getStatsData
> ### Keywords: ~getStatsData ~getStatsList
> 
> ### ** Examples
> 
> ## No test: 
> getStatsList("Hokkaido AND population", surveyYears = 2008)
Error: Not Found 
Execution halted