https://github.com/jsta/wikilake
Scrape lake metadata tables from Wikipedia 🏞
https://github.com/jsta/wikilake
cran lakes limnology rstats wikipedia
Last synced: 11 months ago
JSON representation
Scrape lake metadata tables from Wikipedia 🏞
- Host: GitHub
- URL: https://github.com/jsta/wikilake
- Owner: jsta
- Created: 2017-01-03T13:30:07.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T04:14:27.000Z (over 3 years ago)
- Last Synced: 2024-06-11T17:09:22.936Z (about 2 years ago)
- Topics: cran, lakes, limnology, rstats, wikipedia
- Language: R
- Homepage: https://jsta.github.io/wikilake
- Size: 1.5 MB
- Stars: 8
- Watchers: 1
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "tools/images/"
)
```
# wikilake
[](https://lifecycle.r-lib.org/articles/stages.html#stable)
[](https://cran.r-project.org/package=wikilake)
[](https://travis-ci.org/jsta/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")
```