fillDHSCoordinates: Add DHS locations to malaria data

View source: R/fillDHScoordinates.R

fillDHSCoordinatesR Documentation

Add DHS locations to malaria data

Description

We cannot directly share DHS data. We can share coordinates, but not the data values. This function attempts to fill the data gaps directly from the DHS server using the package rdhs. To use the function you will need to setup an account on the DHS website and request any datasets you wish to use (including requesting the GPS data). Confirmation can take a few days. Once this has been verified, you should be able to use this function.

Usage

fillDHSCoordinates(
  data,
  email = NULL,
  project = NULL,
  cache_path = NULL,
  config_path = NULL,
  global = TRUE,
  verbose_download = FALSE,
  verbose_setup = TRUE,
  data_frame = NULL,
  timeout = 30,
  password_prompt = FALSE,
  prompt = TRUE
)

Arguments

data

Data to add DHS coordinates to

email

Character for email used to login to the DHS website.

project

Character for the name of the DHS project from which datasets should be downloaded.

cache_path

Character for directory path where datasets and API calls will be cached. If left bank, a suitable directory will be created within your user cache directory for your operating system (permission granting).

config_path

Character for where the config file should be saved. For a global configuration, ‘config_path' must be ’~/.rdhs.json'. For a local configuration, ‘config_path' must be ’rdhs.json'. If left bank, the config file will be stored within your user cache directory for your operating system (permission granting).

global

Logical for the config_path to be interpreted as a global config path or a local one. Default = TRUE.

verbose_download

Logical for dataset download progress bars to be shown. Default = FALSE.

verbose_setup

Logical for rdhs setup and messages to be printed. Default = TRUE.

data_frame

Function with which to convert API calls into. If left blank data_frame objects are returned. Must be passed as a character. Examples could be: data.table::as.data.table tibble::as.tibble

timeout

Numeric for how long in seconds to wait for the DHS API to respond. Default = 30.

password_prompt

Logical whether user is asked to type their password, even if they have previously set it. Default = FALSE. Set to TRUE if you have mistyped your password when using set_rdhs_config.

prompt

Logical for whether the user should be prompted for permission to write to files. This should not need be

Details

This function requires the package rdhs which is currently only suggested by the package (not a dependency). So you will need to install it.

Note that the project has to be the exact name in your DHS project.

Author(s)

OJ Watson

Examples

## Not run: 
pf <- malariaAtlas::getPR("all",species = "pf")
pf <- fillDHSCoordinates(pf, 
email = "pretend_email@emaildomain.com",
project = "pretend project name")

## End(Not run)

malariaAtlas documentation built on Oct. 27, 2023, 9:07 a.m.