FAQ

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

Joanna Papakonstantinou
Feb 20, 2013 at 4:54 pm
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?



Thank you for your help.



******************************************************************


*Joanna Papakonstantinou, Ph.D.*
reply

Search Discussions

13 responses

  • Gabor Grothendieck at Feb 20, 2013 at 5:33 pm

    On Wed, Feb 20, 2013 at 11:54 AM, Joanna Papakonstantinou 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úLSE)
    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


    --
    Statistics & Software Consulting
    GKX Group, GKX Associates Inc.
    tel: 1-877-GKX-GROUP
    email: ggrothendieck at gmail.com
  • Gabor Grothendieck at Feb 20, 2013 at 5:52 pm

    On Wed, Feb 20, 2013 at 12:33 PM, Gabor Grothendieck wrote:
    On Wed, Feb 20, 2013 at 11:54 AM, Joanna Papakonstantinou
    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úLSE)
    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
  • Joanna Papakonstantinou at Feb 20, 2013 at 6:01 pm
    I am running as administrator.

    Again, the first 2 tests worked but the 3rd is still giving me an error:
    testInstalledBasic("basic")
    running strict specific tests
    running code in �eval-etc.R�
    comparing �eval-etc.Rout� to �eval-etc.Rout.save� ...[1] 1
    testInstalledBasic("both")
    running strict specific tests
    running code in �eval-etc.R�
    comparing �eval-etc.Rout� to �eval-etc.Rout.save� ...[1] 1
    testInstalledPackages("base",errorsAreFatal=FALSE)
    Error in setwd(outDir) : cannot change working directory


    So since this my installation was standard, do you just recommend I
    unistall and resintsall somewhere else?

    Thank you for your help.

    On Wed, Feb 20, 2013 at 11:33 AM, Gabor Grothendieck wrote:

    On Wed, Feb 20, 2013 at 11:54 AM, Joanna Papakonstantinou
    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

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


    --
    ******************************************************************


    *Joanna Papakonstantinou, Ph.D.*
  • Gabor Grothendieck at Feb 20, 2013 at 6:08 pm

    On Wed, Feb 20, 2013 at 1:01 PM, Joanna Papakonstantinou wrote:
    I am running as administrator.

    Again, the first 2 tests worked but the 3rd is still giving me an error:
    testInstalledBasic("basic")
    running strict specific tests
    running code in ?eval-etc.R?
    comparing ?eval-etc.Rout? to ?eval-etc.Rout.save? ...[1] 1
    testInstalledBasic("both")
    running strict specific tests
    running code in ?eval-etc.R?
    comparing ?eval-etc.Rout? to ?eval-etc.Rout.save? ...[1] 1
    testInstalledPackages("base",errorsAreFatalúLSE)
    Error in setwd(outDir) : cannot change working directory

    I also got errors. There may be something wrong with the tests themselves.




    --
    Statistics & Software Consulting
    GKX Group, GKX Associates Inc.
    tel: 1-877-GKX-GROUP
    email: ggrothendieck at gmail.com
  • Gabor Grothendieck at Feb 20, 2013 at 7:29 pm

    On Wed, Feb 20, 2013 at 1:08 PM, Gabor Grothendieck wrote:
    On Wed, Feb 20, 2013 at 1:01 PM, Joanna Papakonstantinou
    wrote:
    I am running as administrator.

    Again, the first 2 tests worked but the 3rd is still giving me an error:
    testInstalledBasic("basic")
    running strict specific tests
    running code in ?eval-etc.R?
    comparing ?eval-etc.Rout? to ?eval-etc.Rout.save? ...[1] 1
    testInstalledBasic("both")
    running strict specific tests
    running code in ?eval-etc.R?
    comparing ?eval-etc.Rout? to ?eval-etc.Rout.save? ...[1] 1
    testInstalledPackages("base",errorsAreFatalúLSE)
    Error in setwd(outDir) : cannot change working directory
    I also got errors. There may be something wrong with the tests themselves.

    Just a clarification. The errors I was referring to was the fact that
    both you and I got a result of 1 for the first too. That indicates
    that the test and target differed.




    --
    Statistics & Software Consulting
    GKX Group, GKX Associates Inc.
    tel: 1-877-GKX-GROUP
    email: ggrothendieck at gmail.com
  • S Ellison at Feb 20, 2013 at 6:20 pm

    I am getting errors such as:
    testInstalledPackages("base",errorsAreFatalúLSE)
    Error in setwd(outDir) : cannot change working directory

    Er, the first parameter in testInstalledPackages() is the output directory name, not the package name supplied in scope. You probably don;t have a writeable directory called "base"


    Try
    testInstalledPackages(scope="base",errorsAreFatalúLSE)


    S Ellison


    *******************************************************************
    This email and any attachments are confidential. Any use...{{dropped:8}}
  • Joanna Papakonstantinou at Feb 20, 2013 at 7:01 pm
    I ran
    testInstalledPackages(scope="base",errorsAreFatal=FALSE)
    and it completed (and spit out a graph).

    Does this mean I am ok to contunie using this installation of R?
    Should I create an output directory somewhere either in Program Files where
    R is installed or in my working directory?
    Thank you for your time and help.
    On Wed, Feb 20, 2013 at 12:20 PM, S Ellison wrote:


    I am getting errors such as:
    testInstalledPackages("base",errorsAreFatal=FALSE)
    Error in setwd(outDir) : cannot change working directory
    Er, the first parameter in testInstalledPackages() is the output
    directory name, not the package name supplied in scope. You probably don;t
    have a writeable directory called "base"

    Try
    testInstalledPackages(scope="base",errorsAreFatal=FALSE)

    S Ellison

    *******************************************************************
    This email and any attachments are confidential. Any u...{{dropped:20}}
  • Gabor Grothendieck at Feb 20, 2013 at 7:46 pm

    On Wed, Feb 20, 2013 at 2:01 PM, Joanna Papakonstantinou wrote:
    I ran
    testInstalledPackages(scope="base",errorsAreFatalúLSE)
    and it completed (and spit out a graph).

    Does this mean I am ok to contunie using this installation of R?
    Should I create an output directory somewhere either in Program Files where
    R is installed or in my working directory?
    Thank you for your time and help.

    Those tests don't seem to be working and I think you should ignore
    them. You should not have to create an output directory. Installing
    R is just a matter of clicking on OK repeatedly to the installer.
    Everything else is optional, e.g. placing R on your Windows path,
    installing Rtools to build packages (although increasingly even that
    seems unnecessary for some packages and if you download binaries you
    don't have to build packages in the first place), creating a
    customized startup via .Rprofile or related files.
  • S Ellison at Feb 21, 2013 at 1:28 am

    Should I create an output directory somewhere either in Program Files where
    R is installed or in my working directory?
    If I wanted to create a writeable test directory I'd put it in my own workspace, not the program files space.
    But why do you think you need to create an output directory?


    *******************************************************************
    This email and any attachments are confidential. Any use, copying or
    disclosure other than by the intended recipient is unauthorised. If
    you have received this message in error, please notify the sender
    immediately via +44(0)20 8943 7000 or notify pos...@...com
    and delete this message and any copies from your computer and network.
    LGC Limited. Registered in England 2991879.
    Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK
  • Joanna Papakonstantinou at Feb 21, 2013 at 3:46 pm
    I only thought one was missing since it kept giving me error that it wasn't
    set. But all seems to working OK so I guess I don't need to create anything.

    Thank you for your help.
    On Wed, Feb 20, 2013 at 7:28 PM, S Ellison wrote:


    Should I create an output directory somewhere either in Program Files where
    R is installed or in my working directory?
    If I wanted to create a writeable test directory I'd put it in my own
    workspace, not the program files space.
    But why do you think you need to create an output directory?

    *******************************************************************
    This email and any attachments are confidential. Any u...{{dropped:20}}
  • Gabor Grothendieck at Feb 21, 2013 at 8:36 pm

    On Thu, Feb 21, 2013 at 10:46 AM, Joanna Papakonstantinou wrote:
    I only thought one was missing since it kept giving me error that it wasn't
    set. But all seems to working OK so I guess I don't need to create anything.

    No. The first two gave a response of 1 which means they failed.
  • Joanna Papakonstantinou at Feb 21, 2013 at 10:22 pm
    Below is what happened when I ran
    testInstalledPackages(scope="base",errorsAreFatal=FALSE) Testing examples
    for package �base� comparing �base-Ex.Rout� to �base-Ex.Rout.prev�
    ...files differ in number of lines: Testing
    examples for package �tools� comparing �tools-Ex.Rout� to
    �tools-Ex.Rout.save� ... 474c474 < [1] "Matrix" "nlme" "vegan" "mgcv" --- >
    [1] "Matrix" "nlme" "mgcv" 619c619 < [1] "0cce1e42ef3fb133940946534fcf8896"
    --- > [1] "eb723b61539feef013de476e68b5c50a" 844c844 < [1] "R (>= 2.15.1)"
    --- > [1] "R (>= 2.14.0)" Running specific tests for package �tools� Running
    �undoc.R� Testing examples for package �utils� comparing �utils-Ex.Rout� to
    �utils-Ex.Rout.prev� ... files differ in number of lines: Running specific
    tests for package �utils� Running �Sweave-tst.R� Warning: running command
    '"C:/PROGRA~1/R/R-215~1.2/bin/x64/R" CMD BATCH --vanilla --no-timing
    "Sweave-tst.R" "Sweave-tst.Rout" LANGUAGE=C' had status 1 Warning: testing
    'utils' failed Testing examples for package �grDevices� comparing
    �grDevices-Ex.Rout� to �grDevices-Ex.Rout.save� ... OK Running specific
    tests for package �grDevices� Running �ps-tests.R� comparing
    �ps-tests.Rout� to �ps-tests.Rout.save� ... OK Running �xfig-tests.R� comparing
    �xfig-tests.Rout� to �xfig-tests.Rout.save� ... OK Testing examples for
    package �graphics� comparing �graphics-Ex.Rout� to �graphics-Ex.Rout.save�
    ... OK Testing examples for package �stats� comparing �stats-Ex.Rout� to
    �stats-Ex.Rout.save� ... OK Running specific tests for package �stats� Running
    �NLSstClosest.R� Running �cmdscale.R� Running �drop1-polr.R� Running
    �ig_glm.R� Running �ks-test.R� comparing �ks-test.Rout� to
    �ks-test.Rout.save� ... OK Running �nafns.R� Running �nls.R� comparing
    �nls.Rout� to �nls.Rout.save� ... OK Running �offsets.R� Running
    �ppr.R� Running
    �simulate.R� comparing �simulate.Rout� to �simulate.Rout.save� ... OK Running
    �smooth.spline.R� Running �ts-tests.R� Testing examples for package
    �datasets� comparing �datasets-Ex.Rout� to �datasets-Ex.Rout.save� ...
    OK Testing
    examples for package �methods� comparing �methods-Ex.Rout� to
    �methods-Ex.Rout.prev� ... OK Running specific tests for package
    �methods� Running
    �S3.R� Running �basicRefClass.R� Running �duplicateClass.R� Running
    �fieldAssignments.R� Running �mixinInitialize.R� Running
    �namesAndSlots.R� Running
    �nextWithDots.R� Running �refClassExample.R� Running
    �testConditionalIs.R� Running
    �testGroupGeneric.R� Running �testIs.R� Testing examples for package
    �grid� comparing
    �grid-Ex.Rout� to �grid-Ex.Rout.save� ... OK Running specific tests for
    package �grid� Running �bugs.R� Running �reg.R� Running �testls.R� comparing
    �testls.Rout� to �testls.Rout.save� ... OK Running �units.R� Running
    vignettes for package �grid� Testing examples for package �splines� comparing
    �splines-Ex.Rout� to �splines-Ex.Rout.save� ... OK Testing examples for
    package �stats4� comparing �stats4-Ex.Rout� to �stats4-Ex.Rout.save�
    ... OK Running
    specific tests for package �stats4� Running �confint.R� Testing examples
    for package �tcltk� comparing �tcltk-Ex.Rout� to �tcltk-Ex.Rout.prev�
    ...OK Testing
    examples for package �compiler� comparing �compiler-Ex.Rout� to
    �compiler-Ex.Rout.prev� ... OK Running specific tests for package
    �compiler� Running �assign.R� Running �basics.R� Running �const.R� Running
    �envir.R� Running �jit.R� Running �loop.R� Running �switch.R� Testing
    examples for package �parallel� comparing �parallel-Ex.Rout� to
    �parallel-Ex.Rout.prev� ... OK Running specific tests for package
    �parallel� Running �Master.R� Running vignettes for package �parallel�
    I do not really know what any of this means but when I got a graph and no
    explicit errors returned I just wnet ahead with using the installation. I
    have not encountered anything wrong while using is so unless there is
    something you can tell from the above, I guess I will just continue to use
    the current installation.

    Many thanks.
    On Thu, Feb 21, 2013 at 2:36 PM, Gabor Grothendieck wrote:

    On Thu, Feb 21, 2013 at 10:46 AM, Joanna Papakonstantinou
    wrote:
    I only thought one was missing since it kept giving me error that it wasn't
    set. But all seems to working OK so I guess I don't need to create anything.
    No. The first two gave a response of 1 which means they failed.


    --
    ******************************************************************


    *Joanna Papakonstantinou, Ph.D.*
  • Gabor Grothendieck at Feb 22, 2013 at 12:38 am

    On Thu, Feb 21, 2013 at 5:22 PM, Joanna Papakonstantinou wrote:
    Below is what happened when I ran
    testInstalledPackages(scope="base",errorsAreFatalúLSE) Testing examples
    for package ?base? comparing ?base-Ex.Rout? to ?base-Ex.Rout.prev? ... files
    differ in number of lines: Testing examples for package ?tools? comparing
    ?tools-Ex.Rout? to ?tools-Ex.Rout.save? ... 474c474 < [1] "Matrix" "nlme"
    "vegan" "mgcv" --- > [1] "Matrix" "nlme" "mgcv" 619c619 < [1]
    "0cce1e42ef3fb133940946534fcf8896" --- > [1]
    "eb723b61539feef013de476e68b5c50a" 844c844 < [1] "R (>= 2.15.1)" --- > [1]
    "R (>= 2.14.0)" Running specific tests for package ?tools? Running ?undoc.R?
    Testing examples for package ?utils? comparing ?utils-Ex.Rout? to
    ?utils-Ex.Rout.prev? ... files differ in number of lines: Running specific
    tests for package ?utils? Running ?Sweave-tst.R? Warning: running command
    '"C:/PROGRA~1/R/R-215~1.2/bin/x64/R" CMD BATCH --vanilla --no-timing
    "Sweave-tst.R" "Sweave-tst.Rout" LANGUAGE=C' had status 1 Warning: testing
    'utils' failed Testing examples for package ?grDevices? comparing
    ?grDevices-Ex.Rout? to ?grDevices-Ex.Rout.save? ... OK Running specific
    tests for package ?grDevices? Running ?ps-tests.R? comparing ?ps-tests.Rout?
    to ?ps-tests.Rout.save? ... OK Running ?xfig-tests.R? comparing
    ?xfig-tests.Rout? to ?xfig-tests.Rout.save? ... OK Testing examples for
    package ?graphics? comparing ?graphics-Ex.Rout? to ?graphics-Ex.Rout.save?
    ... OK Testing examples for package ?stats? comparing ?stats-Ex.Rout? to
    ?stats-Ex.Rout.save? ... OK Running specific tests for package ?stats?
    Running ?NLSstClosest.R? Running ?cmdscale.R? Running ?drop1-polr.R? Running
    ?ig_glm.R? Running ?ks-test.R? comparing ?ks-test.Rout? to
    ?ks-test.Rout.save? ... OK Running ?nafns.R? Running ?nls.R? comparing
    ?nls.Rout? to ?nls.Rout.save? ... OK Running ?offsets.R? Running ?ppr.R?
    Running ?simulate.R? comparing ?simulate.Rout? to ?simulate.Rout.save? ...
    OK Running ?smooth.spline.R? Running ?ts-tests.R? Testing examples for
    package ?datasets? comparing ?datasets-Ex.Rout? to ?datasets-Ex.Rout.save?
    ... OK Testing examples for package ?methods? comparing ?methods-Ex.Rout? to
    ?methods-Ex.Rout.prev? ... OK Running specific tests for package ?methods?
    Running ?S3.R? Running ?basicRefClass.R? Running ?duplicateClass.R? Running
    ?fieldAssignments.R? Running ?mixinInitialize.R? Running ?namesAndSlots.R?
    Running ?nextWithDots.R? Running ?refClassExample.R? Running
    ?testConditionalIs.R? Running ?testGroupGeneric.R? Running ?testIs.R?
    Testing examples for package ?grid? comparing ?grid-Ex.Rout? to
    ?grid-Ex.Rout.save? ... OK Running specific tests for package ?grid? Running
    ?bugs.R? Running ?reg.R? Running ?testls.R? comparing ?testls.Rout? to
    ?testls.Rout.save? ... OK Running ?units.R? Running vignettes for package
    ?grid? Testing examples for package ?splines? comparing ?splines-Ex.Rout? to
    ?splines-Ex.Rout.save? ... OK Testing examples for package ?stats4?
    comparing ?stats4-Ex.Rout? to ?stats4-Ex.Rout.save? ... OK Running specific
    tests for package ?stats4? Running ?confint.R? Testing examples for package
    ?tcltk? comparing ?tcltk-Ex.Rout? to ?tcltk-Ex.Rout.prev? ... OK Testing
    examples for package ?compiler? comparing ?compiler-Ex.Rout? to
    ?compiler-Ex.Rout.prev? ... OK Running specific tests for package ?compiler?
    Running ?assign.R? Running ?basics.R? Running ?const.R? Running ?envir.R?
    Running ?jit.R? Running ?loop.R? Running ?switch.R? Testing examples for
    package ?parallel? comparing ?parallel-Ex.Rout? to ?parallel-Ex.Rout.prev?
    ... OK Running specific tests for package ?parallel? Running ?Master.R?
    Running vignettes for package ?parallel?
    I do not really know what any of this means but when I got a graph and no
    explicit errors returned I just wnet ahead with using the installation. I
    have not encountered anything wrong while using is so unless there is
    something you can tell from the above, I guess I will just continue to use
    the current installation.

    Many thanks.

    On Thu, Feb 21, 2013 at 2:36 PM, Gabor Grothendieck
    wrote:
    On Thu, Feb 21, 2013 at 10:46 AM, Joanna Papakonstantinou
    wrote:
    I only thought one was missing since it kept giving me error that it
    wasn't
    set. But all seems to working OK so I guess I don't need to create
    anything.

    You can find out what at least some of these things mean by reading
    the help file. On your prior run the first two gave a response of 1
    which, as the help file explains in the Value section, means they
    failed.


    On this one it seems the tests did not match the target because they
    were tested on a different version of R than the tests were prepared
    for.


    I suggest you just forget about these tests. I don't think there is
    anything wrong with your installation.


    By the way, the most recent version of R is R-2.15.2 and you might
    want to use that.












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

Related Discussions

Discussion Navigation
viewthread | post