Client for the 'MoSPI' Microdata Portal

Download unit-level survey microdata from the Ministry of Statistics and Programme Implementation ('MoSPI', Government of India) Microdata Portal < https://microdata.gov.in>. Provides functions to list datasets, list files within a dataset, and download individual files or entire datasets through the portal's 'NADA' API.


mospiR mospiR logo

mospiR is an R client for the MoSPI Microdata Portal. The package downloads unit-level survey data from the Ministry of Statistics and Programme Implementation (MoSPI) of India.

Installation

# CRAN
install.packages("mospiR")

# Development version
remotes::install_github("saketkc/mospiR")

Setup

  1. Get an API key from microdata.gov.in.
  2. Add the key to ~/.Renviron:
MOSPI_KEY=your-key-here
api_key <- Sys.getenv("MOSPI_KEY")

Usage

Search datasets

library(mospiR)

# All datasets (all pages)
all <- list_datasets(api_key)

# Datasets with "labour force" in the title
labour <- list_datasets(api_key, query = "labour force")

# Only page 1
page1 <- list_datasets(api_key, page = 1)

List files in a dataset

files <- list_files("DDI-IND-MOSPI-NSSO-68Rnd-Sch2.0-July2011-June2012", api_key)
files[, c("name", "size")]

Download a single file

download_file(
  dataset_id  = "DDI-IND-MOSPI-NSSO-68Rnd-Sch2.0-July2011-June2012",
  file_name   = "Nss68_1.0_Type2_new format.rar",
  folder_path = "data/nss68",
  api_key     = api_key
)

Download all files in a dataset

download_dataset(
  dataset_id  = "DDI-IND-MOSPI-NSSO-68Rnd-Sch2.0-July2011-June2012",
  folder_path = "data/nss68",
  api_key     = api_key
)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("mospiR")

0.1.0 by Saket Choudhary, a day ago


https://mospir.saketlab.org, https://github.com/saketkc/mospiR


Report a bug at https://github.com/saketkc/mospiR/issues


Browse source code at https://github.com/cran/mospiR


Authors: Saket Choudhary [aut, cre] (ORCID:


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports httr2

Suggests testthat, knitr, rmarkdown


See at CRAN