| Title: | Fetching Data from the 'Displacement Tracking Matrix' |
|---|---|
| Description: | Allows humanitarian community, academia, media, government, and non-governmental organizations to utilize the data collected by the 'Displacement Tracking Matrix' (<https://dtm.iom.int>), a unit in the International Organization for Migration. This also provides non-sensitive Internally Displaced Person figures, aggregated at the country, Admin 1 (states, provinces, or equivalent), and Admin 2 (smaller administrative areas) levels. |
| Authors: | Luong Bang Tran [aut], Assad Asil Companioni [aut, cre], Displacement Tracking Matrix [cph] |
| Maintainer: | Assad Asil Companioni <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0.9000 |
| Built: | 2026-10-09 18:54:37 UTC |
| Source: | https://github.com/displacement-tracking-matrix/dtmapi-r |
Retrieve IDP data at Admin 0 level based on specified parameters. At least one of the following parameters must be provided: operation, admin0_name, or admin0_pcode.
baseline_get_admin0( operation = NULL, admin0_name = NULL, admin0_pcode = NULL, from_reporting_date = NULL, to_reporting_date = NULL, from_round_number = 0, to_round_number = 0 )baseline_get_admin0( operation = NULL, admin0_name = NULL, admin0_pcode = NULL, from_reporting_date = NULL, to_reporting_date = NULL, from_round_number = 0, to_round_number = 0 )
operation |
Optional; Name of the DTM operation for which the data was collected. |
admin0_name |
Optional; Name of the country where the data was collected. |
admin0_pcode |
Optional; Country code (ISO 3166-1 alpha-3). |
from_reporting_date |
Optional; Start date for the reporting period (format: 'YYYY-MM-DD'). |
to_reporting_date |
Optional; End date for the reporting period (format: 'YYYY-MM-DD'). |
from_round_number |
Optional; Starting round number for the data collection range. |
to_round_number |
Optional; Ending round number for the data collection range. |
A data frame containing the IDP Admin0 data matching the specified criteria.
# Fetch IDP data at Admin Level 0 idp_admin0_df <- baseline_get_admin0(admin0_name = "Ethiopia", from_round_number = 1, to_round_number = 10) head(idp_admin0_df)# Fetch IDP data at Admin Level 0 idp_admin0_df <- baseline_get_admin0(admin0_name = "Ethiopia", from_round_number = 1, to_round_number = 10) head(idp_admin0_df)
Retrieve IDP data at Admin 1 level based on specified parameters. At least one of the following parameters must be provided: operation, admin0_name, or admin0_pcode.
baseline_get_admin1( operation = NULL, admin0_name = NULL, admin0_pcode = NULL, admin1_name = NULL, admin1_pcode = NULL, from_reporting_date = NULL, to_reporting_date = NULL, from_round_number = NULL, to_round_number = NULL )baseline_get_admin1( operation = NULL, admin0_name = NULL, admin0_pcode = NULL, admin1_name = NULL, admin1_pcode = NULL, from_reporting_date = NULL, to_reporting_date = NULL, from_round_number = NULL, to_round_number = NULL )
operation |
Optional; Name of the DTM operation for which the data was collected. |
admin0_name |
Optional; Name of the country where the data was collected. |
admin0_pcode |
Optional; Country code (ISO 3166-1 alpha-3). |
admin1_name |
Optional; Name of level 1 administrative boundaries. |
admin1_pcode |
Optional; Place code of level 1 administrative boundaries. |
from_reporting_date |
Optional; Start date for the reporting period (format: 'YYYY-MM-DD'). |
to_reporting_date |
Optional; End date for the reporting period (format: 'YYYY-MM-DD'). |
from_round_number |
Optional; Starting round number for the data collection range. |
to_round_number |
Optional; Ending round number for the data collection range. |
A data frame containing the IDP Admin1 data matching the specified criteria.
# Fetch IDP data at Admin Level 1 idp_admin1_df <- baseline_get_admin1( admin0_name = "Sudan", from_reporting_date = "2020-01-01", to_reporting_date = "2024-08-15" ) head(idp_admin1_df)# Fetch IDP data at Admin Level 1 idp_admin1_df <- baseline_get_admin1( admin0_name = "Sudan", from_reporting_date = "2020-01-01", to_reporting_date = "2024-08-15" ) head(idp_admin1_df)
Retrieve IDP data at Admin 2 level based on specified parameters. At least one of the following parameters must be provided: operation, admin0_name, or admin0_pcode.
baseline_get_admin2( operation = NULL, admin0_name = NULL, admin0_pcode = NULL, admin1_name = NULL, admin1_pcode = NULL, admin2_name = NULL, admin2_pcode = NULL, from_reporting_date = NULL, to_reporting_date = NULL, from_round_number = 0, to_round_number = 0 )baseline_get_admin2( operation = NULL, admin0_name = NULL, admin0_pcode = NULL, admin1_name = NULL, admin1_pcode = NULL, admin2_name = NULL, admin2_pcode = NULL, from_reporting_date = NULL, to_reporting_date = NULL, from_round_number = 0, to_round_number = 0 )
operation |
Optional; Name of the DTM operation for which the data was collected. |
admin0_name |
Optional; Name of the country where the data was collected. |
admin0_pcode |
Optional; Country code (ISO 3166-1 alpha-3). |
admin1_name |
Optional; Name of level 1 administrative boundaries. |
admin1_pcode |
Optional; Place code of level 1 administrative boundaries. |
admin2_name |
Optional; Name of level 2 administrative boundaries. |
admin2_pcode |
Optional; Place code of level 2 administrative boundaries. |
from_reporting_date |
Optional; Start date for the reporting period (format: 'YYYY-MM-DD'). |
to_reporting_date |
Optional; End date for the reporting period (format: 'YYYY-MM-DD'). |
from_round_number |
Optional; Starting round number for the data collection range. |
to_round_number |
Optional; Ending round number for the data collection range. |
A data frame containing the IDP Admin2 data matching the specified criteria.
# Fetch IDP data at Admin Level 2 idp_admin2_df <- baseline_get_admin2(operation = "Yemen conflict", admin0_name = "Yemen") head(idp_admin2_df)# Fetch IDP data at Admin Level 2 idp_admin2_df <- baseline_get_admin2(operation = "Yemen conflict", admin0_name = "Yemen") head(idp_admin2_df)
Retrieve all countries for which DTM data is publicly available through the API.
baseline_get_countries()baseline_get_countries()
A data frame containing the list of all countries.
countries_df <- baseline_get_countries() head(countries_df)countries_df <- baseline_get_countries() head(countries_df)
Retrieve all operations for which DTM data is publicly available through the API.
baseline_get_operations()baseline_get_operations()
A data frame containing the list of all operations.
# Fetch all operations operations_df <- baseline_get_operations() head(operations_df)# Fetch all operations operations_df <- baseline_get_operations() head(operations_df)
The Baseline DTM API subscription key is returned, provided that it is
available in the R session as an environment variable. Users will usually
need to set the BASELINE_DTM_SUBSCRIPTION_KEY environment variable through a
.Renviron file (or other means) or by calling
baseline_set_subscription_key().
baseline_get_subscription_key()baseline_get_subscription_key()
On the other hand, if the TESTTHAT environment variable is true, indicating that unit tests are being run by the package maintainers, then the subscription key is returned through different means.
A string representing a given subscription key for the DTM API.
## Not run: # Generally, calling baseline_set_subscription_key() without the key as an # argument is best, as the user can then be prompted to input the key without # typing it directly into the console, making it more secure and less # likely to be exposed. baseline_set_subscription_key() ## End(Not run)## Not run: # Generally, calling baseline_set_subscription_key() without the key as an # argument is best, as the user can then be prompted to input the key without # typing it directly into the console, making it more secure and less # likely to be exposed. baseline_set_subscription_key() ## End(Not run)
The API subscription key will be stored as an environment variable named "BASELINE_DTM_SUBSCRIPTION_KEY".
baseline_set_subscription_key(..., key = NULL)baseline_set_subscription_key(..., key = NULL)
... |
Any argument here is ignored. It exists solely to discourage typing in the
subscription key directly,
e.g. |
key |
Either NULL or a string representing the key. NULL is preferable: using it will prompt the user to type the subscription key in a graphical user interface that masks it. |
Nothing. Creates / overwrites an environment variable as a side effect.
## Not run: # Generally, calling `baseline_set_subscription_key()` without the key as an # argument is best, as the user can then be prompted to input the key without # typing it directly into the console, making it more secure and less # likely to exposed. baseline_set_subscription_key() ## End(Not run)## Not run: # Generally, calling `baseline_set_subscription_key()` without the key as an # argument is best, as the user can then be prompted to input the key without # typing it directly into the console, making it more secure and less # likely to exposed. baseline_set_subscription_key() ## End(Not run)
Retrieve Household Needs Assessment data at Admin 2 level based on specified parameters. At least one of the following parameters must be provided: admin0_name or admin0_pcode.
hna_get_admin2( admin0_name = NULL, admin0_pcode = NULL, population_group = NULL, year = NULL, page = NULL )hna_get_admin2( admin0_name = NULL, admin0_pcode = NULL, population_group = NULL, year = NULL, page = NULL )
admin0_name |
Optional; Name of the country where the data was collected. |
admin0_pcode |
Optional; Country code (ISO 3166-1 alpha-3). |
population_group |
Optional; A specific subpopulation (e.g. internally displaced persons). |
year |
Optional; Year of data collection. |
page |
Optional; Pagination, to fetch a certain chunk of the data. |
A list of one data frame and a sub-list. The former holds the requested data, and the latter is contains metadata on pagination.
# Fetch HNA data at Admin Level 2 hna_admin2 <- hna_get_admin2(admin0_name = "Mozambique", year = 2025) head(hna_admin2)# Fetch HNA data at Admin Level 2 hna_admin2 <- hna_get_admin2(admin0_name = "Mozambique", year = 2025) head(hna_admin2)
Retrieve the HNA data catalog, which provides information on available indicators in the HNA API, including name, desciption, and data type.
hna_get_catalog()hna_get_catalog()
A data frame representing the data catalog for the HNA.
# Retrieve the HNA data catalog operations_df <- hna_get_catalog() head(operations_df)# Retrieve the HNA data catalog operations_df <- hna_get_catalog() head(operations_df)
Retrieve all countries for which DTM Household Needs Assessment (HNA) data is publicly available through the API.
hna_get_countries()hna_get_countries()
A data frame containing the list of all countries covered.
countries_df <- hna_get_countries() head(countries_df)countries_df <- hna_get_countries() head(countries_df)
The HNA DTM API subscription key is returned, provided that it is
available in the R session as an environment variable. Users will usually
need to set the HNA_DTM_SUBSCRIPTION_KEY environment variable through a
.Renviron file (or other means) or by calling
hna_set_subscription_key().
hna_get_subscription_key()hna_get_subscription_key()
On the other hand, if the TESTTHAT environment variable is true, indicating that unit tests are being run by the package maintainers, then the subscription key is returned through different means.
A string representing a given subscription key for the DTM API.
## Not run: # Generally, calling `hna_set_subscription_key()` without the key as an # argument is best, as the user can then be prompted to input the key without # typing it directly into the console, making it more secure and less # likely to be exposed. hna_set_subscription_key() ## End(Not run)## Not run: # Generally, calling `hna_set_subscription_key()` without the key as an # argument is best, as the user can then be prompted to input the key without # typing it directly into the console, making it more secure and less # likely to be exposed. hna_set_subscription_key() ## End(Not run)
The API subscription key will be stored as an environment variable named "HNA_DTM_SUBSCRIPTION_KEY".
hna_set_subscription_key(..., key = NULL)hna_set_subscription_key(..., key = NULL)
... |
Any argument here is ignored. It exists solely to discourage typing in the
subscription key directly,
e.g. |
key |
Either NULL or a string representing the key. NULL is preferable: using it will prompt the user to type the subscription key in a graphical user interface that masks it. |
Nothing. Creates / overwrites an environment variable as a side effect.
## Not run: # Generally, calling hna_set_subscription_key() without the key as an # argument is best, as the user can then be prompted to input the key without # typing it directly into the console, making it more secure and less # likely to exposed. hna_set_subscription_key() ## End(Not run)## Not run: # Generally, calling hna_set_subscription_key() without the key as an # argument is best, as the user can then be prompted to input the key without # typing it directly into the console, making it more secure and less # likely to exposed. hna_set_subscription_key() ## End(Not run)