Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jsta/wikilake

Scrape lake metadata tables from Wikipedia 🏞
https://github.com/jsta/wikilake

cran lakes limnology rstats wikipedia

Last synced: about 2 months ago
JSON representation

Scrape lake metadata tables from Wikipedia 🏞

Awesome Lists containing this project

README

        

---
output: github_document
---

```{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")
```