Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use temporary directory by default when downloading data #26

Open
Robinlovelace opened this issue Jun 13, 2024 · 0 comments
Open

Use temporary directory by default when downloading data #26

Robinlovelace opened this issue Jun 13, 2024 · 0 comments

Comments

@Robinlovelace
Copy link
Contributor

CRAN can be strict on writing to the hardrive, e.g.: ropensci/osmextract#175

I've not checked but in case some of your functions write to HD by default, I think it's worth making it use tempdir() by default.

This is how we tackled it in {osmextract} and in the prototype {spanishoddata}:

get_data_dir = function() {
  data_dir_env = Sys.getenv("SPANISHOD_DATA_DIR")
  if (data_dir_env == "") {
    data_dir_env = tempdir()
  }
  return(data_dir_env)
}

Source: https://github.com/Robinlovelace/spanishoddata/blob/73528cb2e867c9e99456cbe67fe1c6b08bca8dc8/R/get.R#L63C1-L69C2

And the more mature {osmextract}:

You can set a persistent download_directory by adding the following to your .Renviron file (e.g. with edit_r_environ function in usethis package): OSMEXT_DOWNLOAD_DIRECTORY=/path/to/osm/data.

Source: https://docs.ropensci.org/osmextract/reference/oe_get.html

Happy to have a go at this one at some point...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant