knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)
library(rhxl)

Humanitarian Exchange Language in R

AppVeyor Build Status Travis-CI Build Status codecov

The goal of this package is to provide functions to handle datasets with HXL tags. It is currently work in progress. If you have any ideas on how to further develop the package, please feel free to open an issue or a pull request.

HXL is a different kind of data standard, designed to improve information sharing during a humanitarian crisis without adding extra reporting burdens. hxlstandard.org

Install

To install the current development version use devtools:

devtools::install_github("dirkschumacher/rhxl")

API by Example

Read in the aiports of Viet Nam.

data_url <- "http://ourairports.com/countries/VN/airports.hxl"
hxl_data <- as_hxl(read.csv(data_url))
head(hxl_data)

You can get the schema as a tidy long table:

hxl_schema(hxl_data)

Or as a character vector in the order of the columns:

hxl_schema_chr(hxl_data)

We can also test, if a dataset supports a schema. For example, we could test if the dataset has lat/lng coordinates.

hxl_validate(hxl_data, c("#geo +lat", "#geo +lon"))

With this information you could for example write a function that can automatically display a dataset on a map - without much configuration by the user. It also makes sharing of information easier.

In addition you can select certain columns based on tags:

hxl_select(hxl_data, c("#geo +lat", "#geo +lon"))


dirkschumacher/rhxl documentation built on May 15, 2019, 8:49 a.m.