-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
83 lines (64 loc) · 2.22 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
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 = "tools/images/"
)
```
# wikilake
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/wikilake)](https://cran.r-project.org/package=wikilake)
[![Travis-CI Build Status](https://travis-ci.org/jsta/wikilake.svg?branch=master)](https://travis-ci.org/jsta/wikilake)
[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/wikilake)](https://CRAN.R-project.org/package=wikilake)
The `wikilake` package provides functions to scrape the metadata tables from lake pages on Wikipedia.
## Installation
## Stable release from CRAN
`install.packages("wikilake")`
## Development version
`devtools::install_github("jsta/wikilake")`
## Usage
```{r example}
library(wikilake)
```
```{r metadata only, warning=FALSE}
# metadata only, see units of numeric fields with wikilake::unit_key_()
lake_wiki("Lake Mendota")
```
```{r }
# use the clean = FALSE argument to get raw data
# (i.e. avoid parsing of numeric fields)
lake_wiki("Lake Mendota", clean = FALSE)
```
```{r }
# pretty printing metadata
```
```{r echo = FALSE, message=FALSE}
knitr::kable(
dplyr::left_join(
tidyr::pivot_longer(lake_wiki("Lake Mendota"),
cols = tidyr::everything(),
values_to = "values_numeric",
values_transform = list(values_numeric = as.character)),
tidyr::pivot_longer(lake_wiki("Lake Mendota", clean = FALSE),
cols = tidyr::everything(),
values_to = "values_raw",
values_transform = list(values_raw = as.character)),
by = "name"))
```
```{r worldmapping}
# metadata + map
lake_wiki("Gull Lake (Michigan)", map = TRUE)
```
```{r mapping}
lake_wiki("Gull Lake (Michigan)", map = TRUE, database = "usa")
```
```{r mapping2}
lake_wiki("Lake Nipigon", map = TRUE, regions = "Canada")
```
```{r mapping3}
lake_wiki("Cass Lake (Michigan)", map = TRUE, database = "state", regions = "Michigan")
```