[R] Error in setwd(outDir) : cannot change working directory

Gabor Grothendieck ggrothendieck at gmail.com
Wed Feb 20 18:52:07 CET 2013


On Wed, Feb 20, 2013 at 12:33 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> On Wed, Feb 20, 2013 at 11:54 AM, Joanna Papakonstantinou
> <joanna.papa at gmail.com> wrote:
>> I installed R on my Windows laptop in C:\Program Files\R\R-2.15.2
>>
>> and am able to open RGUI  (640bit), see packages and run commands. However,
>> when I test the installation and run the basic tests and all the tests on
>> the standard and recommended packages i.e.:
>>
>>       library("tools")
>>
>>       testInstalledBasic("both")
>>
>>       testInstalledPackages("base", errorsAreFatal = FALSE)
>>
>>       testInstalledPackages("recommended", errorsAreFatal = FALSE)
>>
>>
>>
>> I am getting errors such as:
>>
>>  > testInstalledPackages("base",errorsAreFatal=FALSE)
>>
>>  Error in setwd(outDir) : cannot change working directory
>>
>>
>>
>> my working driectory is:
>>
>>>getwd()
>>
>> [1] "C:/Users/jpapa/Documents"
>>  In which I see R folder as well as the .rData from my last session.
>>
>> what does the wd have to do with the output directory? Do  I need to create
>> an output directory? DO I need to setwd(outDir)?
>>
>> do i need to change the wd (for example to the Pogram Files directory where
>> R is installed or to another directory I need to create? if so, how do I do
>> this?
>>
>>
>>
>>
>>
>> i also noticed that i have packages in
>>
>> \library ‘C:/Users/jpapa/Documents/R/win-library/2.15’
>>
>> and in library ‘C:/Program Files/R/R-2.15.2/library’.
>>
>> Do all packages need to be in one place? If so, should they be in my
>> Documents or in Program Files?
>
> Its likely trying to write in the C:\Program Files tree but lacks
> permission. Run R with Administrator permissions or re-install R
> elsewhere, e.g. C:\R

Also regarding your questions your setup is the standard desirable
setup (with a separate user library) and R in the \Program Files tree
so there seems nothing wrong with your library setup or how R itself
has been set up on your system.



-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list