jennybc/here_here

Missing advantage of here

Opened this issue · 3 comments

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.

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.

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.

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