understanding here package benefits

I keep seeing discussions about the benefits of using the here package. The initial premise is always that it is a good replacement for setwd(). I agree with that sentiment. Using setwd() is not a great idea and I have never used it. However, I have also never used here and I have not had any path-related issues.

I understand the challenge of defining the path in a standalone script, but to use here, you need to have an R project. If you have a project, your working directory is already properly set. In that case, here() is just getwd(). What is the benefit of the extra layer?

I think the key benefit is when dealing with Rmarkdown documents which allow the .rmd files to be in sub-folders. Check this for an example:
http://jenrichmond.rbind.io/post/how-to-use-the-here-package/

1 Like

That's an interesting point. But wouldn't you know when you start the project if your files are .R or .Rmd and if they are in sub-folders or not?

This is the link I had been searching for which hopefully fleshes out the explanation I couldn't find it first time):

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.