#7 automatically change working directory

open
nobody
None
5
2010-03-08
2010-03-08
Pieter
No

It would be nice if R's working directory could somehow automatically be changed to the path of the file that is currently being edited, either when R is started or when the script is executed. Right now I have to add a setwd() to every script, but that causes problems when several people are working on the same file. Tinn-R, which I used before I moved to Linux, has this feature by the way.

Discussion

  • Dan Dediu
    Dan Dediu
    2010-03-09

    Hi,
    this is a good idea, indeed, but I have a bit of a problem with it, namely given that you can have more than one tab open in gedit and more than one R console, how is the association between the gedit tab and R console to be done? One solution might be to say to an R console to cwd() to a user-chosen gedit tab - would this address your problem?
    Best,
    Dan

     
  • Pieter
    Pieter
    2010-03-09

    That would definitely be an improvement as compared to browsing to the directory manually. Another possibility would be an option to cwd to the current tab each time "run whole file" is clicked, but I think your proposal is more versatile.

    Keep up the good work!
    Pieter

     
  • Dan Dediu
    Dan Dediu
    2010-03-11

    I'll include that in the next version (on which I am working right now).
    Thanks for th suggestion!