[R] Why can I reset directory in using setwd on desktop but not on laptop

peter dalgaard pdalgd at gmail.com
Fri Oct 9 21:29:18 CEST 2015


> On 09 Oct 2015, at 17:58 , WRAY NICHOLAS <nicholas.wray at ntlworld.com> wrote:
> 
> Thanks Sarah  I didn't realise that there was a distinction between between
> asking about R per se and asking about r-studio...  I shall try specifying the
> path and see whether that helps   Thanks, Nick

The key part of the story is not necessarily Rstudio specific, though:

You said that your laptop  "won't allow me to reset the directory by a setwd command".

Now what makes you think that? I can imagine a number of misinterpretations that might lead you there without it actually being true. So:

- Is there an error message? 
- What exactly did you type in?
- Does the directory actually exist on both machines?
- Are we talking about machines with the same architecure? (e.g., is one a PC and the other one a Mac?)
- If you do a getwd() before and after the setwd(), what happens?

-pd

> 
>> 
>>    On 09 October 2015 at 16:51 Sarah Goslee <sarah.goslee at gmail.com> wrote:
>> 
>> 
>>    Sounds like an RStudio question to me. Someone might be able to help,
>>    but this mailing list is for R.
>> 
>>    You should also provide sessionInfo() output when asking potentially
>>    OS-related questions.
>> 
>>    You can always specify path as part of the write.csv() or other output
>>    command; you don't need to change the working directory necessarily.
>> 
>>    Sarah
>> 
>>    On Fri, Oct 9, 2015 at 11:43 AM, WRAY NICHOLAS
>>    <nicholas.wray at ntlworld.com> wrote:
>>> Hi I am running the same r routine on both my desktop and my laptop, and
>>> writing results in the form of csv files into storage folders in the
>>> respective
>>> users/documents files of both machines My desktop machine allows me to
>>> reset
>>> the directory in the course of the r programme so that I can write the
>>> files
>>> into different folders which makes it easier to keep track of what's
>>> what,
>>> whereas my laptop won't allow me to reset the directory by a setwd
>>> command, and
>>> I have to set the directory manually using the r studio tabs, so
>>> basically on
>>> the laptop every results file is going into the same folder, which is
>>> not
>>> unworkable but not as easy to use later
>>> 
>>> As far as I know I have the same r studio on both machines. Does anyone
>>> out
>>> there know a) why I can't use a setwd command on the laptop, and b)is
>>> there
>>> anything I can do to put this right?
>>> 
>>> Thanks beforehand, as it were
>>> 
>>> Nick Wray
>> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list