[R] Is it possible to set a default working directory for all R consoles?

Ebert,Timothy Aaron tebert @end|ng |rom u||@edu
Fri Jun 17 19:40:28 CEST 2022


At least in Windows having nested directories of the same name is valid. I think it unwise because of the potential for confusion, especially if multiple people will be using the directory. The other issue is that having nested directories of the same name increases path length. Some programs have trouble when a file name and path get past some character limit. Finally, long path names are more prone to typing errors. At least in R, I copy and paste path names from Explorer but then have to go back and change \ into / to get things to work.
Tim

-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of Jeff Newmiller
Sent: Friday, June 17, 2022 12:46 PM
To: r-help using r-project.org; Spencer Graves <spencer.graves using effectivedefense.org>
Subject: Re: [R] Is it possible to set a default working directory for all R consoles?

[External Email]

While a discussion of working directories appears to address the thoughts expressed by OP, this error seems to be affecting R's ability to find a HOME directory from which to retrieve such items as the .Rprofile file and the default user directory. As such, it needs to be solved before worrying about which IDE to use or whether setting a universal working directory is a good idea.

I don't know the specific answer, but Bill's suggestion seems promising to me.

I did notice that the erroneous path also contained two nested "profile" directories... I have never seen this before, but that doesn't necessarily mean it is wrong... just seems odd.

On June 17, 2022 9:17:01 AM PDT, Spencer Graves <spencer.graves using effectivedefense.org> wrote:
>         I use the free version of RStudio, and I routinely work with "Projects".  For new projects, I first I create a new project directory in Finder (in a Mac) or Windows Explorer if it does not already exist. Then in RStudio, I do File > "New Project..." > in "Existing Directory".
>
>
>         Then when I want to work on an existing project, I can do File > "Recent Projects" in RStudio.  Or I can double click on the appropriate *.Rproj file in Finder or Windows Explorer.
>
>
>         Hope this helps.
>         Spencer Graves
>
>
>On 6/17/22 10:46 AM, Bill Dunlap wrote:
>> Is there an environment variable containing that IP address?
>>
>>       as.list(grep(value=TRUE, "172", Sys.getenv())) # as.list to 
>> make printing nicer
>>
>> If you know which variable is causing the problem you may be able to 
>> override it by setting an R-specific one.
>>
>> -Bill
>>
>> On Fri, Jun 17, 2022 at 8:28 AM IAGO GINÉ VÁZQUEZ <iago.gine using sjd.es> wrote:
>>
>>> Hi all,
>>>
>>> Is there some way to set a default working directory each time R.exe 
>>> is opened? I ask this because Always that I open R 4.2.o in Windows 
>>> 10 I get the next warning messages
>>>
>>> Warning message:
>>> In normalizePath(path.expand(path), winslash, mustWork) :
>>>    path[1]="\\172.19.2.44\profiles\profiles\me\Documents": Access is 
>>> denied Warning message:
>>> In normalizePath(path.expand(path), winslash, mustWork) :
>>>    path[1]="\\172.19.2.44\profiles\profiles\me\Documents": Access is 
>>> denied Warning message:
>>> In normalizePath(path.expand(path), winslash, mustWork) :
>>>    path[1]="\\172.19.2.44\profiles\profiles\me\Documents": Access is 
>>> denied Warning message:
>>> In normalizePath(path.expand(path), winslash, mustWork) :
>>>    path[1]="\\172.19.2.44\profiles\profiles\me\Documents": Access is 
>>> denied
>>>
>>> Even from cmd.exe in a  C: location
>>>
>>> C:\Users\me>R
>>> Warning message:
>>> In normalizePath(path.expand(path), winslash, mustWork) :
>>>
>>>
>>>               
>>> path[1]="\\172.19.2.44\profiles\profiles\me\Documents": Access is 
>>> denied Warning message:
>>> In normalizePath(path.expand(path), winslash, mustWork) :
>>>       path[1]="\\172.19.2.44\profiles\profiles\me\Documents": Access 
>>> is denied Warning message:
>>> In normalizePath(path.expand(path), winslash, mustWork) :
>>>       path[1]="\\172.19.2.44\profiles\profiles\me\Documents": Access 
>>> is denied Warning message:
>>> In normalizePath(path.expand(path), winslash, mustWork) :
>>>       path[1]="\\172.19.2.44\profiles\profiles\me\Documents": Access 
>>> is denied
>>>
>>> Reading
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__cran.r-2Dprojec
>>> t.org_bin_windows_base_rw-2DFAQ.html-23What-2Dare-2DHOME-2Dand-2Dwor
>>> king-2Ddirectories-5F003f&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh
>>> 2kVeAsRzsn7AkP-g&m=BQr4uevYaXrkdUBxnwQAsvj8tBoLWJWrxywmRAh9UFty0XNrg
>>> b8AvEp2RG5r9mRz&s=ewUVpVtCgppOGT8w9h7W2lPKvYQuxVuFA9AQZo0bJ3M&e= , 
>>> first I cannot apply the suggested solution (I cannot see such 
>>> "shortcut’s properties"), and second, I am not interested just in 
>>> Rgui, or even RStudio, but other terminals running R (like 
>>> VSCode-radian or
>>> SublimeText-Terminus)
>>>
>>> Thanks in advance.
>>>
>>> Best wishes,
>>>
>>> Iago
>>>
>>>
>>>
>>>          [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see 
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_ma
>>> ilman_listinfo_r-2Dhelp&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2k
>>> VeAsRzsn7AkP-g&m=BQr4uevYaXrkdUBxnwQAsvj8tBoLWJWrxywmRAh9UFty0XNrgb8
>>> AvEp2RG5r9mRz&s=34YJoiQXMGD5d-AxYVPWqbe_AwYwHKFqj-skRXnbNo4&e=
>>> PLEASE do read the posting guide
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.
>>> org_posting-2Dguide.html&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2
>>> kVeAsRzsn7AkP-g&m=BQr4uevYaXrkdUBxnwQAsvj8tBoLWJWrxywmRAh9UFty0XNrgb
>>> 8AvEp2RG5r9mRz&s=FPSw6wA0aGqiMUaFUAVMewdYBcxozs6UvBniYIe4bgw&e=
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>      [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see 
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mai
>> lman_listinfo_r-2Dhelp&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVe
>> AsRzsn7AkP-g&m=BQr4uevYaXrkdUBxnwQAsvj8tBoLWJWrxywmRAh9UFty0XNrgb8AvE
>> p2RG5r9mRz&s=34YJoiQXMGD5d-AxYVPWqbe_AwYwHKFqj-skRXnbNo4&e=
>> PLEASE do read the posting guide 
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.o
>> rg_posting-2Dguide.html&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kV
>> eAsRzsn7AkP-g&m=BQr4uevYaXrkdUBxnwQAsvj8tBoLWJWrxywmRAh9UFty0XNrgb8Av
>> Ep2RG5r9mRz&s=FPSw6wA0aGqiMUaFUAVMewdYBcxozs6UvBniYIe4bgw&e=
>> and provide commented, minimal, self-contained, reproducible code.
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see 
>https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailm
>an_listinfo_r-2Dhelp&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRz
>sn7AkP-g&m=BQr4uevYaXrkdUBxnwQAsvj8tBoLWJWrxywmRAh9UFty0XNrgb8AvEp2RG5r
>9mRz&s=34YJoiQXMGD5d-AxYVPWqbe_AwYwHKFqj-skRXnbNo4&e=
>PLEASE do read the posting guide 
>https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org
>_posting-2Dguide.html&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsR
>zsn7AkP-g&m=BQr4uevYaXrkdUBxnwQAsvj8tBoLWJWrxywmRAh9UFty0XNrgb8AvEp2RG5
>r9mRz&s=FPSw6wA0aGqiMUaFUAVMewdYBcxozs6UvBniYIe4bgw&e=
>and provide commented, minimal, self-contained, reproducible code.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=BQr4uevYaXrkdUBxnwQAsvj8tBoLWJWrxywmRAh9UFty0XNrgb8AvEp2RG5r9mRz&s=34YJoiQXMGD5d-AxYVPWqbe_AwYwHKFqj-skRXnbNo4&e=
PLEASE do read the posting guide https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=BQr4uevYaXrkdUBxnwQAsvj8tBoLWJWrxywmRAh9UFty0XNrgb8AvEp2RG5r9mRz&s=FPSw6wA0aGqiMUaFUAVMewdYBcxozs6UvBniYIe4bgw&e=
and provide commented, minimal, self-contained, reproducible code.


More information about the R-help mailing list