Re: [R] Difficulties with setting working directory

2016-10-18 Thread Roebuck,Paul L
On 10/14/16, 1:52 PM, "R-help on behalf of Anže Dejak" wrote:

>So, the thing with my version of R (I'm using RStudio for R x64 3.3.0 in,
>currently, Windows 7) is, that I'm able to set the working directory
>temporary (through using setwd() function), but once I try to set it
>permanently (through "Session -> Set Working Directory -> Choose
>Directory..."), this error appears: Error in setwd("~/...") : cannot
>change
>working directory.
>
>As I've seen online on certain forums, the problem, supposedly, is that R
>in Windows is unable to recognize the ~ sign. But without it, I'm unable
>to
>set the working directory for more than a session.
>
>I'd hope you have a possible answer to this error.

Two problems:

1) R won't convert "~" to its shell equivalent without using path.expand()
2) There is no "..." directory [only "." (current) or ".." (parent)]

The information contained in this e-mail message may be privileged, 
confidential, and/or protected from disclosure. This e-mail message may contain 
protected health information (PHI); dissemination of PHI should comply with 
applicable federal and state laws. If you are not the intended recipient, or an 
authorized representative of the intended recipient, any further review, 
disclosure, use, dissemination, distribution, or copying of this message or any 
attachment (or the information contained therein) is strictly prohibited. If 
you think that you have received this e-mail message in error, please notify 
the sender by return e-mail and delete all references to it and its contents 
from your systems.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Difficulties with setting working directory

2016-10-15 Thread Duncan Murdoch

On 14/10/2016 2:52 PM, Anže Dejak wrote:

Greetings,

Firstly, I'd hope this is the correct e-mail address to ask about specific
problems refering to problems with R. If it isn't, I kindly ask of you to
re-direct me to the correct contact person.

So, the thing with my version of R (I'm using RStudio for R x64 3.3.0 in,
currently, Windows 7) is, that I'm able to set the working directory
temporary (through using setwd() function), but once I try to set it
permanently (through "Session -> Set Working Directory -> Choose
Directory..."), this error appears: Error in setwd("~/...") : cannot change
working directory.

As I've seen online on certain forums, the problem, supposedly, is that R
in Windows is unable to recognize the ~ sign. But without it, I'm unable to
set the working directory for more than a session.


That explanation is incorrect.  R in Windows simulates a Unix shell 
interpretation of ~ .  See ?path.expand for an explanation, and run


path.expand("~")

to see how it is currently being expanded for you.

However, the fact that R interprets ~ doesn't mean it is always possible 
to use setwd() to go there.


It's also possible that RStudio has a bug, and is trying to change to a 
nonexistent directory before displaying choices to you, assuming you're 
getting the error before being offered the dialog to pick a directory.
If that's the case, you might be able to avoid the problem by asking R 
to make the change:


setwd(choose.dir())

or

setwd("a/specific/directory")

Duncan Murdoch

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Difficulties with setting working directory

2016-10-15 Thread Jim Lemon
Hi Anze,
I'm not sure that this will work on Windows, but you can create a
function named ".First" (note the leading period) with something like
this:

.First<-function() setwd("C:/Users/anze")

To do this, start a session, enter the above line and then quit the
session, saving the current workspace. When you start R again, it
should change to that working directory. Of course you should make
sure what your home directory is.

Jim


On Sat, Oct 15, 2016 at 5:52 AM, Anže Dejak  wrote:
> Greetings,
>
> Firstly, I'd hope this is the correct e-mail address to ask about specific
> problems refering to problems with R. If it isn't, I kindly ask of you to
> re-direct me to the correct contact person.
>
> So, the thing with my version of R (I'm using RStudio for R x64 3.3.0 in,
> currently, Windows 7) is, that I'm able to set the working directory
> temporary (through using setwd() function), but once I try to set it
> permanently (through "Session -> Set Working Directory -> Choose
> Directory..."), this error appears: Error in setwd("~/...") : cannot change
> working directory.
>
> As I've seen online on certain forums, the problem, supposedly, is that R
> in Windows is unable to recognize the ~ sign. But without it, I'm unable to
> set the working directory for more than a session.
>
> I'd hope you have a possible answer to this error.
>
> Thank you for your time and for reading this long e-mail and I hope you
> have a fine day, Anže D.
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] Difficulties with setting working directory

2016-10-14 Thread Anže Dejak
Greetings,

Firstly, I'd hope this is the correct e-mail address to ask about specific
problems refering to problems with R. If it isn't, I kindly ask of you to
re-direct me to the correct contact person.

So, the thing with my version of R (I'm using RStudio for R x64 3.3.0 in,
currently, Windows 7) is, that I'm able to set the working directory
temporary (through using setwd() function), but once I try to set it
permanently (through "Session -> Set Working Directory -> Choose
Directory..."), this error appears: Error in setwd("~/...") : cannot change
working directory.

As I've seen online on certain forums, the problem, supposedly, is that R
in Windows is unable to recognize the ~ sign. But without it, I'm unable to
set the working directory for more than a session.

I'd hope you have a possible answer to this error.

Thank you for your time and for reading this long e-mail and I hope you
have a fine day, Anže D.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.