project path in Rmd
On Thu, 2 Apr 2020 11:02:56 +0200
Ivan Calandra <calandra at rgzm.de> wrote:
I do not know this ".." command (could you please show me how to use it in a relative path?), but it sounds like a good start.
Each '..' in the path moves you up one level in the directory tree.
Here I use '..' once to access the sibling of the current directory,
then verify my assumption using the absolute path:
setwd('~/temp')
setwd('../archive')
getwd() == path.expand('~/archive')
# [1] TRUE
A related thing is using '.' to mean the *current* directory (i.e. the
value of getwd()). It is sometimes useful e.g. if you have a file named
'~' in your current directory and want to avoid expanding it to your
home directory.
But it implies that I know in advance how many folders up the parent directory is.
Yes, I think that hardcoding some part of *within-project* directory
structure is unavoidable. But it shouldn't cause any troubles as long
as the project (analysis/{scripts,raw_data,derived_data}) is considered
as a whole.
Best regards, Ivan