R/explore_dir.R
explore_dir.Rd
Current version only tries to: Find two files, one .csv and the other .geojson and pass them to TGVE as `defaultURL` and `geographyURL` respectively. It will also look at their column names and try to find matching columns. If there is one file, it passes it to `explore_file` function.
explore_dir(path, background = FALSE)
character of a data directory.
logical value whether to run instance in `callr`.
no value returned, depending on `background` either a or not blocking `plumber::pr` instance is started. A message is displayed with instance details.
{
p = file.path(tempdir(), "data")
dir.create(p)
gURL = paste0("https://raw.githubusercontent.com/saferactive/",
"tgve/main/pf-only-name.geojson")
dURL = "https://raw.githubusercontent.com/saferactive/tgve/main/ksi-pf.csv"
download.file(gURL, destfile = file.path(p, "pf.geojson"))
download.file(dURL, destfile = file.path(p, "data.csv"))
ps = explore_dir(p, background = TRUE)
ps$kill()
unlink(p, recursive = TRUE)
}
#> More than one matching columns found between the two files
#> using the first matchin column as `geographyColumn` value.
#> http://127.0.0.1:8000/data.csv http://127.0.0.1:8000/geoURL police_force
#> Running plumber at: http://127.0.0.1/8000