Package 'wikilake'

Title: Scrape Lake Metadata Tables from Wikipedia
Description: Scrape lake metadata tables from Wikipedia <https://www.wikipedia.org/>.
Authors: Jemma Stachelek [aut, cre]
Maintainer: Jemma Stachelek <[email protected]>
License: GPL (>= 2)
Version: 0.7.0
Built: 2024-09-30 04:50:47 UTC
Source: https://github.com/jsta/wikilake

Help Index


Scrape Wikipedia lakes metadata

Description

Scrape Wikipedia lakes metadata

Author(s)

[email protected]


dms2dd

Description

Convert numeric coordinate vectors in degrees, minutes, and seconds to decimal degrees

Usage

dms2dd(x)

Arguments

x

numeric vector of length 3 corresponding to degrees, minutes, and seconds

Examples

dt <- rbind(c(25,12,53.66),c(-80,32,00.61))
apply(dt, 1, function(x) dms2dd(x))

get_lake_wiki

Description

get_lake_wiki

Usage

get_lake_wiki(lake_name, cond = NA)

Arguments

lake_name

character

cond

character stopping condition

Examples

## Not run: 
get_lake_wiki("Lake Nipigon")

## End(Not run)

Clean output of lake_wiki

Description

Currently the only operation is to standardize the units of numeric fields. See the output units with the unit_key_ function.

Usage

lake_clean(dt)

Arguments

dt

output of the lake_wiki function

Examples

## Not run: 
dt <- lake_wiki(c("Lake Mendota","Flagstaff Lake (Maine)"))
dt_clean <- lake_clean(dt)

dt <- lake_wiki(c("Lake Mendota","Trout Lake (Wisconsin)"))
dt_clean <- lake_clean(dt)

## End(Not run)

lake_wiki

Description

lake_wiki

Usage

lake_wiki(lake_name, map = FALSE, clean = TRUE, ...)

Arguments

lake_name

character

map

logical produce map of lake location?

clean

logical enforce standardized units following wikilake::unit_key_()?

...

arguments passed to maps::map

Examples

## Not run: 
lake_wiki("Lake Peipsi")
lake_wiki("Flagstaff Lake (Maine)")
lake_wiki("Lake George (Michigan-Ontario)")
lake_wiki("Lake Michigan", map = TRUE, "usa")
lake_wiki("Lac La Belle, Michigan")
lake_wiki("Lake Antoine")
lake_wiki("Lake Baikal")
lake_wiki("Dockery Lake (Michigan)")
lake_wiki("Coldwater Lake")
lake_wiki("Bankson Lake")
lake_wiki("Fisher Lake (Michigan)")
lake_wiki("Beals Lake")
lake_wiki("Devils Lake (Michigan)")
lake_wiki("Lake Michigan")
lake_wiki("Fletcher Pond")
lake_wiki("Lake Bella Vista (Michigan)")
lake_wiki("Lake Mendota")
lake_wiki("Lake Mendota", map = TRUE, "usa")
lake_wiki("Lake Nipigon", map = TRUE, regions = "Canada")
lake_wiki("Trout Lake (Wisconsin)")

# a vector of lake names
lake_wiki(c("Lake Mendota","Trout Lake (Wisconsin)"))
lake_wiki(c("Lake Mendota","Trout Lake (Wisconsin)"), map = TRUE)

# throws warning on redirects
lake_wiki("Beals Lake")

# ignore notability box
lake_wiki("Rainbow Lake (Waterford Township, Michigan)")

## End(Not run)

lake_wiki_browser

Description

lake_wiki_browser

Usage

lake_wiki_browser(lake_wiki_obj = NA, lake_names = NA)

Arguments

lake_wiki_obj

data.frame output of lake_wiki

lake_names

fallback character vector of lake names

Examples

## Not run: 
lake_wiki_browser(lake_names = "Lake Mendota")
lake_wiki_browser(lake_names = c("Lake Mendota", "Lake Champlain"))
lake_wiki_browser(lake_wiki(c("Lake Mendota", "Lake Champlain")))

## End(Not run)

map_lake_wiki

Description

map_lake_wiki

Usage

map_lake_wiki(res, ...)

Arguments

res

data.frame output of get_lake_wiki

...

arguments passed to maps::map

Examples

## Not run: 
map_lake_wiki(lake_wiki("Corey Lake"), database = "usa")

map_lake_wiki(lake_wiki("Lake Nipigon"), regions = "Canada")

## End(Not run)

Michigan Lakes

Description

Metadata of Michigan lakes scraped from Wikipedia.

Format

A data frame with 48 columns and 177 rows:

  • Name: lake name

  • Location: location description

  • Primary inflows: rivers and streams

  • Basin countries: countries

  • Surface area: hectares

  • Max. depth: meters

  • Surface elevation: meters

  • Lat: decimal degrees

  • Lon: decimal degrees

  • Primary outflows: rivers and streams

  • Average depth: meters

  • Max. length: meters

  • Max. width: meters


Parse string representation of units package quantities

Description

Parse string representation of units package quantities

Usage

parse_unit_brackets(x, target_unit = NA)

Arguments

x

character string with unit in brackets

target_unit

target unit to convert to. optional

Examples

x <- "1 [m]"
x <- "8.5 [m]"
parse_unit_brackets(x, "feet")

tidy_lake_df

Description

tidy_lake_df

Usage

tidy_lake_df(lake)

Arguments

lake

data.frame output of get_lake_wiki