-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
69 lines (48 loc) · 2.09 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
library(rhxl)
```
# Humanitarian Exchange Language in R
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/dirkschumacher/rhxl?branch=master&svg=true)](https://ci.appveyor.com/project/dirkschumacher/rhxl)
[![Travis-CI Build Status](https://travis-ci.org/dirkschumacher/rhxl.svg?branch=master)](https://travis-ci.org/dirkschumacher/rhxl)
[![codecov](https://codecov.io/gh/dirkschumacher/rhxl/branch/master/graph/badge.svg)](https://codecov.io/gh/dirkschumacher/rhxl)
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](http://hxlstandard.org/standard/1_0final/)
## Install
To install the current development version use devtools:
```R
devtools::install_github("dirkschumacher/rhxl")
```
## API by Example
Read in the aiports of Viet Nam.
```{r}
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:
```{r}
hxl_schema(hxl_data)
```
Or as a character vector in the order of the columns:
```{r}
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.
```{r}
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:
```{r}
hxl_select(hxl_data, c("#geo +lat", "#geo +lon"))
```