[R] project path in Rmd
jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Thu Apr 2 10:56:14 CEST 2020
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 empty Project.RData file will do it. Or you can use RStudio Project.Rproj files the same way.
On April 2, 2020 1:40:07 AM PDT, Ivan Calandra <calandra using rgzm.de> wrote:
>But if I do not use setwd(), the current working directory is NOT the
>That's what my problem is about... I guess I was not clear in my
>Dr. Ivan Calandra
>TraCEr, laboratory for Traceology and Controlled Experiments
>MONREPOS Archaeological Research Centre and
>Museum for Human Behavioural Evolution
>56567 Neuwied, Germany
>+49 (0) 2631 9772-243
>On 02/04/2020 10:37, Jeff Newmiller wrote:
>> I recommend not using setwd. Then you can always assume your current
>working directory is your project directory and reference relative to
>> On April 2, 2020 1:30:29 AM PDT, Ivan Calandra <calandra using rgzm.de>
>>> Dear useRs,
>>> I believe this is R code so appropriate for this list, but let me
>>> if this relates more to RStudio itself.
>>> I am working on an RStudio project. In that project directory, I
>>> folder called 'analysis' and in there a folder called 'scripts'
>>> My data files needed for the scripts are in '~/analysis/raw_data'
>>> the output should be in '~/analysis/derived_data'.
>>> My scripts are Rmd files, so when I knit them, their working
>>> is where they are located, i.e. '~/analysis/scripts'. The problem I
>>> have is to specify the path for 'raw_data' and 'derived_data' since
>>> during the rendering I am not relative to the project directory
>>> And these folders are not subfolders of the working directory
>>> I hope I am clear here...
>>> I would like to avoid absolute paths of course, but I do not know
>>> What would be nice is a way to get the project directory in the
>>> rather than their working directory.
>>> Does that make sense?
>>> Thank you in advance
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.
Sent from my phone. Please excuse my brevity.
More information about the R-help