[R] Can't there be a cd command?

Liaw, Andy andy_liaw at merck.com
Wed May 10 16:11:02 CEST 2006


From: Paul Johnson
> 
> It is a FAQ in our Linux lab.  People start emacs and fire up 
> R via ess, and then they have no idea 'where they are".  For 
> computer experts, it is not a problem, but for people who 
> don't know much about computers, it is a pretty big problem.  
> They have data in some subdirectory, but almost invariably 
> they don't get emacs & R started from that same place.

ESS by default will prompt for start-up directory when starting 
R.  Perhaps that was turned off in the lab?

 
> Unfortunately, for our users, it does not help to simply 
> re-label setwd as cd.  Both commands imply a deeper 
> understanding of the OS than they have.  Also, unfortunately, 
> these are the same people who don't understand that FAQs 
> exist and should be consulted. These people are so new/timid 
> that asking in r-help would be the last thing to cross their mind.
> 
> I've wondered if it would not help to have the R prompt 
> include the directory name, as in an x terminal.

Here's one possibility (on WinXP Pro):

> h <- taskCallbackManager() 
> h$add(function(expr, value, ok, visible) { 
+     options(prompt=paste(getwd(),"> ", sep=""))
+     return(TRUE)}, name="pwdprompt") 
[1] "pwdprompt"
C:/home > setwd("projects")
C:/home/projects > 

Andy

 
> pj
> 
> On 5/10/06, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> 
> >
> > Exactly.  I don't think I have ever used setwd() on Linux.
> >
> > Also, I have never seen this asked before for a Unix-alike, so it 
> > seems not to be a >F<AQ.  There is a common tendency for 
> users who run 
> > into a problem to think everyone does too, and it isn't 
> necessarily so.
> > Frequently asked questions do make it to the FAQs: it is a defence 
> > mechanism for the volunteers supporting R.
> >
> > help.search("directory")  gets you there.
> >
> > --
> > Brian D. Ripley,                  ripley at stats.ox.ac.uk
> > Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> > University of Oxford,             Tel:  +44 1865 272861 (self)
> > 1 South Parks Road,                     +44 1865 272866 (PA)
> > Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! 
> > http://www.R-project.org/posting-guide.html
> >
> 
> 
> --
> Paul E. Johnson
> Professor, Political Science
> 1541 Lilac Lane, Room 504
> University of Kansas
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>




More information about the R-help mailing list