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

Missing advantage of here #6

Open
cportner opened this issue Mar 25, 2018 · 3 comments
Open

Missing advantage of here #6

cportner opened this issue Mar 25, 2018 · 3 comments

Comments

@cportner
Copy link

First, thank you for advertising "here". It makes it even easier to use relative paths. Second, one advantage of the package that you do not mention is that it becomes possible to do away with "paste0" commands for file names based on variables. Hence, it becomes possible to code something like this without having to mess around with "paste".

for (obs in 1:length(directory_list$name)) {

  # Get file name and Google Drive ID
  file_name <- directory_list$name[obs]
  file_id <- directory_list$id[obs]
  print(file_name)

  # Download file
  drive_download(
    as_id(file_id),
    path = here("data", file_name),
    overwrite = TRUE
  )
}

If you think it worthwhile, I can write up a smaller version of this and add it. If you think it would distract from the central message, that is fine too.

@francisbarton
Copy link

I think this is a good advantage to note. Very neat. The text is not especially long at present and I think your example could be added, but that is up to the owner. I have given your idea a +1 fwiw.

@liuyanguu
Copy link

I have been using here for a while. Indeed when I recommend this package to others I was not very sure what are the overwhelming advantages. Since if operating within a project, the directory to files is already very simple.

@francisbarton
Copy link

You're right, if your project just stays in one folder and all your files are in a stable location within or under that folder.
I think here() comes into its own when you want to use sub-folders and use setwd(); here helps you avoid "../" relative reference paths as well as avoiding non-portable fixed file paths.
https://twitter.com/ludictech/status/1164867065733423104

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

3 participants