A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ropensci/FedData/issues/95 below:

get_nhd() does not save data to extraction.dir if that directory already exists · Issue #95 · ropensci/FedData · GitHub

When directory "./one/two/" does not exist, the call below behaves as expected by (a) creating a directory "./one/two/" and (b) creating a file "./one/two/meve_nhd.gpkg".

NHD <- get_nhd(
  template = FedData::meve,
  label = "meve",
  extraction.dir = "./one/two/")

However, if you run this same exact line again, now that directory "./one/two/" already exists, the call instead creates a file "./one/twomeve_nhd.gpkg". This occurs even if the original "./one/two/meve_nhd.gpkg" file is deleted before running the second attempt.

Aside from saving the file to the wrong direct and the wrong name, this error effectively renders useless force.redo = TRUE.

Adding a "/" to the third line of the function, as follows, seems to fix the problem (a slash like this is indeed used in analogous lines of functions like get_ssurgo(), get_ned(), get_daymet(), etc.), but I can't say I understand why the behavior is different depending on whether or not the directory already exists.

out_dsn <- paste0(extraction.dir, "/", label, "_nhd.gpkg")


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4