Re: [R] setting new working directories

2007-01-05 Thread Jim Lemon
Bill Shipley wrote:
> Hello, and Happy New Year.  My default working directory is getting very
> cluttered.  I know that I should be using a different working directory for
> each project (I work in Windows), but do not know how to go about creating
> different ones and moving back and forth between them.  I have read Venables
> & Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of
> date with respect to this topic and have searched through the documentation
> but cannot find a clear explanation for doing this.  Can someone point me to
> the proper documentation for creating and using different working
> directories from within Windows (please, no comments about switching to
> UNIX...).
> Thanks.
> 
I'm not sure to which New Year you refer, but thanks and the same to you.

I think you may want to automatically start up R in a directory for each 
project. There is a discussion of that in Kickstarting R at:

http://cran.r-project.org/doc/contrib/Lemon-kickstart/kr_start.html

Basically, you can create icons on the desktop that will start R in a 
number of directories. In Windows, don't worry about adding the line to 
your "R" startup file, just set the "Start Program in" to the desired 
directory in the Properties dialog of the shortcut.

You can also set up an R file that gives you an interactive choice when 
the program starts. Create a file like this:

cat("R programming\n")
cat("Animals\n")
cat("Vegetables\n")
cat("Minerals\n")
cat("Type in the first letter of the project -")
answer<-toupper(strsplit(readline(""))[1])
if(answer == "R") setwd("c:/jim/R/programs")
if(answer == "A") setwd("c:/jim/things/animals")
...

and say you name it c:\jim\R\SelectProject.R
(notice that Windows uses backslashes but you use slashes in R)

put the following line in your .First function:

source("c:/jim/R/SelectProject.R")

and you should be able to select your project and directory on startup.

Jim

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] setting new working directories

2007-01-04 Thread Duncan Murdoch
On 1/4/2007 12:48 PM, Duncan Murdoch wrote:
> On 1/4/2007 9:41 AM, Bill Shipley wrote:
>> Hello, and Happy New Year.  My default working directory is getting very
>> cluttered.  I know that I should be using a different working directory for
>> each project (I work in Windows), but do not know how to go about creating
>> different ones and moving back and forth between them.  I have read Venables
>> & Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of
>> date with respect to this topic and have searched through the documentation
>> but cannot find a clear explanation for doing this.  Can someone point me to
>> the proper documentation for creating and using different working
>> directories from within Windows (please, no comments about switching to
>> UNIX...).
> 
> I don't think R has facilities for creating directories:  you would do 
> that in the OS, e.g. in Windows Explorer, right click and ask for "New | 
> Folder".

A couple of people have pointed out dir.create() to me.  I would have 
found it with

help.search('directory')

Duncan Murdoch

> 
> In Windows the easiest way to set a directory as the current working 
> directory is
> 
> setwd(choose.dir())
> 
> In the choose.dir dialog you can type the directory name in standard 
> Windows format (don't worry about escaping \), or you can use the 
> directory browser to choose it.
> 
> By the way, if you do decide to switch to Unix, you'll have to do 
> without choose.dir() (unless it's in a contributed package somewhere).
> 
> Duncan Murdoch
> 
> __
> R-help@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
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] setting new working directories

2007-01-04 Thread Gabor Grothendieck
If you are working on Windows XP then downlaod the batchfiles
distribution whose home page is at:

http://code.google.com/p/batchfiles/

This will provide a bunch of batch files that are useful in connection
with using R.

At the Windows console this command shows you your path

   path

so place Rgui.bat from the batchfiles distribution in any of
the folders listed in the path or in the folder you want to be
your working directory.  Then issue this command at the
Windows console:

  Rgui.bat

That will start up R with the working directory set to the current
directory.

It also automatically finds which version of R you are using from the
registry so you don't have to do anything each time you install
a new version of R (unlike other methods).

On 1/4/07, Bill Shipley <[EMAIL PROTECTED]> wrote:
> Hello, and Happy New Year.  My default working directory is getting very
> cluttered.  I know that I should be using a different working directory for
> each project (I work in Windows), but do not know how to go about creating
> different ones and moving back and forth between them.  I have read Venables
> & Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of
> date with respect to this topic and have searched through the documentation
> but cannot find a clear explanation for doing this.  Can someone point me to
> the proper documentation for creating and using different working
> directories from within Windows (please, no comments about switching to
> UNIX...).
> Thanks.
>
> Bill Shipley
>
> __
> R-help@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
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] setting new working directories

2007-01-04 Thread Duncan Murdoch
On 1/4/2007 9:41 AM, Bill Shipley wrote:
> Hello, and Happy New Year.  My default working directory is getting very
> cluttered.  I know that I should be using a different working directory for
> each project (I work in Windows), but do not know how to go about creating
> different ones and moving back and forth between them.  I have read Venables
> & Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of
> date with respect to this topic and have searched through the documentation
> but cannot find a clear explanation for doing this.  Can someone point me to
> the proper documentation for creating and using different working
> directories from within Windows (please, no comments about switching to
> UNIX...).

I don't think R has facilities for creating directories:  you would do 
that in the OS, e.g. in Windows Explorer, right click and ask for "New | 
Folder".

In Windows the easiest way to set a directory as the current working 
directory is

setwd(choose.dir())

In the choose.dir dialog you can type the directory name in standard 
Windows format (don't worry about escaping \), or you can use the 
directory browser to choose it.

By the way, if you do decide to switch to Unix, you'll have to do 
without choose.dir() (unless it's in a contributed package somewhere).

Duncan Murdoch

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] setting new working directories

2007-01-04 Thread Earl F. Glynn
Bill,

I like to use Windows Explorer to find folders and then launch R with the 
selected folder as the working directory.

I put some notes online about this:
http://research.stowers-institute.org/efg/R/TechNote/WindowsExplorerWorkingDirectory/index.htm

efg

"Bill Shipley" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello, and Happy New Year.  My default working directory is getting very
> cluttered.  I know that I should be using a different working directory 
> for
> each project (I work in Windows), but do not know how to go about creating
> different ones and moving back and forth between them.

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] setting new working directories

2007-01-04 Thread Barry Rowlingson
Bill Shipley wrote:

>> Hello, and Happy New Year.  My default working directory is getting very
>> cluttered.  I know that I should be using a different working directory for
>> each project (I work in Windows), but do not know how to go about creating
>> different ones and moving back and forth between them.  


  If you make a new directory, then in it put a copy of a shortcut to R 
(actually to Rgui.exe in R's bin directory) then right click on the 
shortcut, select 'Properties', and set the 'start in' to your new 
working directory, you can browse to that directory in windows, double 
click the R shortcut, and be working in that new working directory with 
no setwd() needed.

Barry

PS oh, I mean 'folder' not 'directory' of course, this is Windows...

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] setting new working directories

2007-01-04 Thread Professor Brian Ripley
Abhijit Dasgupta wrote:
> An additional note for Windows. The directory name needs to be written 
> as "C:/Project/Working directory" or "C:\\Project\\Working directory" as 
> opposed to the usual way of referencing directories in Windows.

Which are?  Those are the forms given in the Microsoft documentation.

The 2002 edition of MASS is not at all out of date: the 1994 edition is
explicitly about S-PLUS (and the 'Windows' version of S-PLUS in 1994 was 
in fact a DOS program running under an extender).


> AA wrote:
>> use setwd() and getwd(). see ?setwd
>> or on the shortcut properties tab, set the target directory to your working 
>> dir and have
>> as many shortcuts as working directories.
>> working with R commands does it for me.
>> all the best.
>> A.
>>
>> - Original Message 
>> From: Bill Shipley <[EMAIL PROTECTED]>
>> To: R help list 
>> Sent: Thursday, January 4, 2007 9:41:35 AM
>> Subject: [R] setting new working directories
>>
>> Hello, and Happy New Year.  My default working directory is getting very
>> cluttered.  I know that I should be using a different working directory for
>> each project (I work in Windows), but do not know how to go about creating
>> different ones and moving back and forth between them.  I have read Venables
>> & Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of
>> date with respect to this topic and have searched through the documentation
>> but cannot find a clear explanation for doing this.  Can someone point me to
>> the proper documentation for creating and using different working
>> directories from within Windows (please, no comments about switching to
>> UNIX...).
>> Thanks.
>>
>> Bill Shipley
>>
>> __
>> R-help@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
>> and provide commented, minimal, self-contained, reproducible code.
>>
>> __
>> R-help@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
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> __
> R-help@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
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] setting new working directories

2007-01-04 Thread Abhijit Dasgupta
An additional note for Windows. The directory name needs to be written 
as "C:/Project/Working directory" or "C:\\Project\\Working directory" as 
opposed to the usual way of referencing directories in Windows.

AA wrote:
> use setwd() and getwd(). see ?setwd
> or on the shortcut properties tab, set the target directory to your working 
> dir and have
> as many shortcuts as working directories.
> working with R commands does it for me.
> all the best.
> A.
>
> - Original Message 
> From: Bill Shipley <[EMAIL PROTECTED]>
> To: R help list 
> Sent: Thursday, January 4, 2007 9:41:35 AM
> Subject: [R] setting new working directories
>
> Hello, and Happy New Year.  My default working directory is getting very
> cluttered.  I know that I should be using a different working directory for
> each project (I work in Windows), but do not know how to go about creating
> different ones and moving back and forth between them.  I have read Venables
> & Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of
> date with respect to this topic and have searched through the documentation
> but cannot find a clear explanation for doing this.  Can someone point me to
> the proper documentation for creating and using different working
> directories from within Windows (please, no comments about switching to
> UNIX...).
> Thanks.
>
> Bill Shipley
>
> __
> R-help@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
> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@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
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] setting new working directories

2007-01-04 Thread AA
use setwd() and getwd(). see ?setwd
or on the shortcut properties tab, set the target directory to your working dir 
and have
as many shortcuts as working directories.
working with R commands does it for me.
all the best.
A.

- Original Message 
From: Bill Shipley <[EMAIL PROTECTED]>
To: R help list 
Sent: Thursday, January 4, 2007 9:41:35 AM
Subject: [R] setting new working directories

Hello, and Happy New Year.  My default working directory is getting very
cluttered.  I know that I should be using a different working directory for
each project (I work in Windows), but do not know how to go about creating
different ones and moving back and forth between them.  I have read Venables
& Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of
date with respect to this topic and have searched through the documentation
but cannot find a clear explanation for doing this.  Can someone point me to
the proper documentation for creating and using different working
directories from within Windows (please, no comments about switching to
UNIX...).
Thanks.

Bill Shipley

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] setting new working directories

2007-01-04 Thread Chuck Cleland
Bill Shipley wrote:
> Hello, and Happy New Year.  My default working directory is getting very
> cluttered.  I know that I should be using a different working directory for
> each project (I work in Windows), but do not know how to go about creating
> different ones and moving back and forth between them.  I have read Venables
> & Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of
> date with respect to this topic and have searched through the documentation
> but cannot find a clear explanation for doing this.  Can someone point me to
> the proper documentation for creating and using different working
> directories from within Windows (please, no comments about switching to
> UNIX...).
> Thanks.

  RSiteSearch("working directory") is very helpful.  In particular, look
at the help pages for getwd() and setwd().

> Bill Shipley
> 
> __
> R-help@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
> and provide commented, minimal, self-contained, reproducible code.

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] setting new working directories

2007-01-04 Thread Abhijit Dasgupta
The basic command for this is setwd() (for "set working directory")

You can save your workspace after you use the setwd command, and this 
will create a .RData file in that directory. In windows you can click on 
the .RData directory to open R using that particular working directory. 
You can always check on the current working directory using getwd().

Another useful command in this context is save.image (see ?save.image 
for details)

Abhijit
Bill Shipley wrote:
> Hello, and Happy New Year.  My default working directory is getting very
> cluttered.  I know that I should be using a different working directory for
> each project (I work in Windows), but do not know how to go about creating
> different ones and moving back and forth between them.  I have read Venables
> & Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of
> date with respect to this topic and have searched through the documentation
> but cannot find a clear explanation for doing this.  Can someone point me to
> the proper documentation for creating and using different working
> directories from within Windows (please, no comments about switching to
> UNIX...).
> Thanks.
>
> Bill Shipley
>
> __
> R-help@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
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] setting new working directories

2007-01-04 Thread ONKELINX, Thierry
See ?getwd and ?setwd to set the working directory
See ?load and ?save to read the workspace.

Cheers,

Thierry




ir. Thierry Onkelinx

Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature
and Forest

Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance

Gaverstraat 4

9500 Geraardsbergen

Belgium

tel. + 32 54/436 185

[EMAIL PROTECTED]

www.inbo.be 

 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt

A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney


-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Bill Shipley
Verzonden: donderdag 4 januari 2007 15:42
Aan: R help list
Onderwerp: [R] setting new working directories

Hello, and Happy New Year.  My default working directory is getting very
cluttered.  I know that I should be using a different working directory
for
each project (I work in Windows), but do not know how to go about
creating
different ones and moving back and forth between them.  I have read
Venables
& Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems
out of
date with respect to this topic and have searched through the
documentation
but cannot find a clear explanation for doing this.  Can someone point
me to
the proper documentation for creating and using different working
directories from within Windows (please, no comments about switching to
UNIX...).
Thanks.

Bill Shipley

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


[R] setting new working directories

2007-01-04 Thread Bill Shipley
Hello, and Happy New Year.  My default working directory is getting very
cluttered.  I know that I should be using a different working directory for
each project (I work in Windows), but do not know how to go about creating
different ones and moving back and forth between them.  I have read Venables
& Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of
date with respect to this topic and have searched through the documentation
but cannot find a clear explanation for doing this.  Can someone point me to
the proper documentation for creating and using different working
directories from within Windows (please, no comments about switching to
UNIX...).
Thanks.

Bill Shipley

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.