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

set download directory #66

Closed
ktoddbrown opened this issue Sep 17, 2018 · 10 comments
Closed

set download directory #66

ktoddbrown opened this issue Sep 17, 2018 · 10 comments
Milestone

Comments

@ktoddbrown
Copy link

Hi I was wondering if there was a way to set the download directory without reseting the environmental variables?

-Kathe

Session Info
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] curl_3.2

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18     rstudioapi_0.7   xml2_1.2.0       bindr_0.1.1      magrittr_1.5     rappdirs_0.3.1  
 [7] hms_0.4.2        tidyselect_0.2.4 R6_2.2.2         rlang_0.2.2      plyr_1.8.4       httr_1.3.1      
[13] stringr_1.3.1    SoilDataR_0.0.1  pangaear_0.6.0   dplyr_0.7.6      tools_3.5.0      utf8_1.1.3      
[19] cli_1.0.0        yaml_2.1.19      readxl_1.1.0     assertthat_0.2.0 httpcode_0.2.0   tibble_1.4.2    
[25] crayon_1.3.4     bindrcpp_0.2.2   purrr_0.2.5      readr_1.1.1      tidyr_0.8.1      triebeard_0.3.0 
[31] crul_0.6.0       glue_1.3.0       oai_0.2.2        stringi_1.2.4    compiler_3.5.0   pillar_1.2.2    
[37] cellranger_1.1.0 urltools_1.7.1   lubridate_1.7.4  pkgconfig_2.0.2 
@sckott
Copy link
Contributor

sckott commented Sep 17, 2018

Thanks for this. Are you talking about a specific function?

@ktoddbrown
Copy link
Author

Sorry! I'm looking to download pangaea data to a specified local directory and then load the data into R and be able to work with it offline. I'm running the below function (and data set):

data.df <- pangaear::pg_data(doi = '10.1594/PANGAEA.863689')

@sckott
Copy link
Contributor

sckott commented Sep 18, 2018

@ktoddbrown what "environmental variables" are you talking about?

@sckott
Copy link
Contributor

sckott commented Sep 18, 2018

we store the base path to save files to in env$path, so in theory you could change that path, but it's not exported to the user right now. i can see about letting the user set the working directory

@ktoddbrown
Copy link
Author

Yep, this is what I was interested in.

@sckott
Copy link
Contributor

sckott commented Sep 18, 2018

can you reinstall remotes::install_github("ropensci/pangaear@cache-path"), restart R session, and try again. See pg_cache$cache_path_set() to set the cache path

@sckott
Copy link
Contributor

sckott commented Sep 18, 2018

changes in caa3cb3

@ktoddbrown
Copy link
Author

This is not quite what I was looking for. I would like to download the files to a specified directory. For example right now

> pg_cache$cache_path_set('/Users/name/Documents/Datasets')
[1] "/Users/name/Library/Caches/R//Users/name/Documents/Datasets"
> pg_cache$cache_path_get()
[1] "/Users/name/Library/Caches/R//Users/name/Documents/Datasets"

but I would like to point the director to: the folder "/Users/name/Documents/Datasets"

@sckott
Copy link
Contributor

sckott commented Oct 2, 2018

I've been planning to make it easier to set the path directly ropensci/hoardr#12 but not done yet. for now try this:

x = pg_cache
x
#> <hoard>
#>   path: pangaear
#>   cache path: /Users/sckott/Library/Caches/R/pangaear
iset_the_path <- function(path) x$.__enclos_env__$private$hoard_env$cache_path <- path
iset_the_path("/Users/name/Documents/Datasets")
x
#> <hoard>
#>   path: pangaear
#>   cache path: /Users/name/Documents/Datasets

@sckott sckott added this to the v0.8 milestone Aug 12, 2019
@sckott
Copy link
Contributor

sckott commented Aug 13, 2019

@ktoddbrown sorry for the very long wait on this - done now - can install from github master branch. just set your own path with pg_cache$cache_path_set(full_path = "/Foo/Bar")

@sckott sckott closed this as completed Aug 13, 2019
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

2 participants