located_in_box: Locations In the Box

View source: R/located_in_box.R

located_in_boxR Documentation

Locations In the Box

Description

Creates a new column (in_box) that tells whether the lat/long is in a certain box or not.

Usage

located_in_box(
  .,
  lat_column = "lat",
  lng_column = "lng",
  top_left_lat,
  top_left_lng,
  bottom_right_lat,
  bottom_right_lng
)

Arguments

.

Data Frame that has been locationized. see weed::split_locations

lat_column

Name of column containing Latitude data

lng_column

Name of column containing Longitude data

top_left_lat

Latitude at top left corner of box

top_left_lng

Longitude at top left corner of box

bottom_right_lat

Latitude at bottom right corner of box

bottom_right_lng

Longitude at bottom right corner of box

Value

A dataframe that contains the latlong box data

Examples

d <- tibble::tribble(
~value,  ~location_word,                    ~Country,     ~lat,       ~lng,
"city of new york",      "new york",                       "USA", 40.71427,  -74.00597,
"kerala, chennai municipality, and san francisco",  "kerala", "India", 10.41667,       76.5,
"kerala, chennai municipality, and san francisco",  "chennai",  "India", 13.08784,   80.27847)
located_in_box(d, lat_column = "lat",
lng_column = "lng",
top_left_lat = 45,
bottom_right_lat = 12,
top_left_lng = -80,
bottom_right_lng = 90)

weed documentation built on Oct. 17, 2023, 1:06 a.m.