Re: [R] project path in Rmd

2020-04-02 Thread Ivan Calandra
Thanks Jeff, I was just completely unaware of these options! Now I know. Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0)

Re: [R] project path in Rmd

2020-04-02 Thread Jeff Newmiller
Where did this false dichotomy come from? The rmarkdown::render function has quite flexible parameters for compiling rmarkdown files in subdirectories without changing the current directory. And RStudio has a Global configuration to enable compiling using the Project directory as "current" under

Re: [R] project path in Rmd (Ivan Calandra)

2020-04-02 Thread Ivan Calandra
() package. > > https://here.r-lib.org/ > > Best, > Tim Howard > > >> Date: Thu, 2 Apr 2020 10:21:47 +0100 >> From: Rui Barradas >> To: Ivan Calandra >> Cc: "r-help@r-project.org" >> Subject: Re: [R] project path in Rmd >> Mess

Re: [R] project path in Rmd (Ivan Calandra)

2020-04-02 Thread Howard, Tim G (DEC) via R-help
You also should be able to reference locations from the 'root' of your project using the here() package. https://here.r-lib.org/ Best, Tim Howard > Date: Thu, 2 Apr 2020 10:21:47 +0100 > From: Rui Barradas > To: Ivan Calandra > Cc: "r-help@r-project.org&qu

Re: [R] project path in Rmd

2020-04-02 Thread Ivan Krylov
On Thu, 2 Apr 2020 11:02:56 +0200 Ivan Calandra 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

Re: [R] project path in Rmd

2020-04-02 Thread Rui Barradas
Hello, This is not an answer to the original problem, it's about '..'. (And a bit more.) About '..', see if the following sequence of instructions can help. Subdirectories '~/tmp' and '~/snap' exist on my PC, change to '~/analysis/scripts' or to what makes sense on yours. od <- getwd()

Re: [R] project path in Rmd

2020-04-02 Thread Ivan Calandra
What about searching for the .Rproj file and using its path as the new working directory using setwd()? But I know that it is indeed not recommended in knitted files (FAQ #5 ). And I do not know how to search up the folder structure anyway... Ivan -- Dr. Ivan Caland

Re: [R] project path in Rmd

2020-04-02 Thread Ivan Calandra
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. But it implies that I know in advance how many folders up the parent directory is. I guess in most cases it will always be the same, but it would be even better if it coul

Re: [R] project path in Rmd

2020-04-02 Thread Ivan Krylov
On Thu, 2 Apr 2020 10:30:29 +0200 Ivan Calandra wrote: > The problem I then have is to specify the path for 'raw_data' and > 'derived_data' <...> And these folders are not subfolders of > the working directory '~/analysis/scripts'. > I would like to avoid absolute paths of course Is there a re

Re: [R] project path in Rmd

2020-04-02 Thread Ivan Calandra
So what you're saying is that I should have scripts in the project directory and not in a subfolder within it, right? But what if I need (or at least want) to? Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museu

Re: [R] project path in Rmd

2020-04-02 Thread Jeff Newmiller
Make it so. Outside R. At the command line, use cd before you start R. This should feel natural. In a GUI file browser, double clicking on a file type assigned to a program by default sets the containing directory to be current directory before kicking off the program, so double-clicking on an

Re: [R] project path in Rmd

2020-04-02 Thread Jeff Newmiller
I recommend not using setwd. Then you can always assume your current working directory is your project directory and reference relative to that. On April 2, 2020 1:30:29 AM PDT, Ivan Calandra wrote: >Dear useRs, > >I believe this is R code so appropriate for this list, but let me know >if this r

Re: [R] project path in Rmd

2020-04-02 Thread Ivan Calandra
Hi Jeff, But if I do not use setwd(), the current working directory is NOT the project directory. That's what my problem is about... I guess I was not clear in my email... Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Cen