pl_search: Search for a place, name or location.

Description Usage Arguments Details Note Examples

View source: R/pl_search.R

Description

This function searches a locally created SQLite database created from csv files.

Usage

1
2
3
4
5
6
7

Arguments

query

A place ID. If left NULL, returns the table, which is of class tbl, which can then be passed on to other dplyr functions.

...

Further args passed on to dplyr::tbl()

Details

On the first query if not run before, the function takes a bit to get the raw data (if not already gotten), temporarily load the raw csv data, then create a SQLite database, and create the pointer to it. Subsequent calls should be very fast.

There is a function pl_cache, used to download the raw csv files. That function is run internally in these functions if you have not run it before, or if only some fo the files are present.

Note

Requires RSQLite package

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
pl_search()
pl_search_loc()
pl_search_names()
pl_search_places()

pl_search_loc("SELECT * FROM locations limit 5")
pl_search_names("SELECT * FROM names limit 5")
pl_search_places("SELECT * FROM places limit 5")

library(dplyr)
locs <- pl_search("SELECT * FROM locations limit 1000") %>%
  select(pid, reprLat, reprLong)
nms <- pl_search("SELECT * FROM names limit 1000") %>% select(pid)
left_join(locs, nms, "pid", copy = TRUE) %>% collect %>% NROW

## End(Not run)

ropensci/pleiades documentation built on Jan. 1, 2021, 2:57 p.m.